From: Christian Babeux Date: Fri, 22 Feb 2013 03:26:41 +0000 (-0500) Subject: Tests: Rename the UST tests runners to test_ X-Git-Tag: v2.2.0-rc1~60^2~14 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e5be53a084ca2d0fd6540c6da59fa8909dfac8f8;p=lttng-tools.git Tests: Rename the UST tests runners to test_ Signed-off-by: Christian Babeux --- diff --git a/tests/regression/ust/before-after/Makefile.am b/tests/regression/ust/before-after/Makefile.am index d197d72f5..f883a3270 100644 --- a/tests/regression/ust/before-after/Makefile.am +++ b/tests/regression/ust/before-after/Makefile.am @@ -12,5 +12,5 @@ noinst_PROGRAMS = gen-nevents gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h gen_nevents_LDADD = -llttng-ust -noinst_SCRIPTS = run -EXTRA_DIST = run +noinst_SCRIPTS = test_before_after +EXTRA_DIST = test_before_after diff --git a/tests/regression/ust/before-after/run b/tests/regression/ust/before-after/run deleted file mode 100755 index cb1f8c2cd..000000000 --- a/tests/regression/ust/before-after/run +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash -# -# Copyright (C) - 2012 David Goulet -# -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -TEST_DESC="UST tracer - Start tracing before and after execution" - -CURDIR=$(dirname $0)/ -TESTDIR=$CURDIR/../../.. -NR_ITER=100 -SESSION_NAME="per-session" -EVENT_NAME="ust_gen_nevents:tptest" - -source $TESTDIR/utils/utils.sh - -print_test_banner "$TEST_DESC" - -if [ ! -x "$CURDIR/gen-nevents" ]; then - echo -e "No UST nevents binary detected. Passing." - exit 0 -fi - -# MUST set TESTDIR before calling those functions - -test_before_apps() { - local out - - # BEFORE application is spawned - create_lttng_session $SESSION_NAME $TRACE_PATH - enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_lttng_tracing $SESSION_NAME - # Start test - echo -n "Starting application... " - ./$CURDIR/gen-nevents $NR_ITER - echo -n "Ended " - print_ok - stop_lttng_tracing $SESSION_NAME - destroy_lttng_session $SESSION_NAME - - trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH - - return $? -} - -test_after_apps() { - local out - - echo -n "Starting application... " - ./$CURDIR/gen-nevents 100 & - print_ok - - # BEFORE application is spawned - create_lttng_session $SESSION_NAME $TRACE_PATH - enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_lttng_tracing $SESSION_NAME - - # At least hit one event - sleep 2 - - stop_lttng_tracing $SESSION_NAME - destroy_lttng_session $SESSION_NAME - - out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) - if [ $out -eq 0 ]; then - echo -n "No event found. Suppose to have at least one... " - print_fail - out=1 - else - echo -n "Found $out event(s). Coherent... " - print_ok - out=0 - fi - - return $out -} - -# MUST set TESTDIR before calling those functions - -start_lttng_sessiond - -echo "" -echo "=== Start application BEFORE tracing was started ===" - -TRACE_PATH=$(mktemp -d) - -test_before_apps -out=$? -if [ $out -ne 0 ]; then - stop_lttng_sessiond - exit $out -fi - -rm -rf $TRACE_PATH - -echo "" -echo "=== Start application AFTER tracing was started ===" - -TRACE_PATH=$(mktemp -d) - -test_after_apps -out=$? -if [ $out -ne 0 ]; then - stop_lttng_sessiond - exit $out -fi - -stop_lttng_sessiond - -rm -rf $TRACE_PATH diff --git a/tests/regression/ust/before-after/test_before_after b/tests/regression/ust/before-after/test_before_after new file mode 100755 index 000000000..cb1f8c2cd --- /dev/null +++ b/tests/regression/ust/before-after/test_before_after @@ -0,0 +1,120 @@ +#!/bin/bash +# +# Copyright (C) - 2012 David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Start tracing before and after execution" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../../.. +NR_ITER=100 +SESSION_NAME="per-session" +EVENT_NAME="ust_gen_nevents:tptest" + +source $TESTDIR/utils/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -x "$CURDIR/gen-nevents" ]; then + echo -e "No UST nevents binary detected. Passing." + exit 0 +fi + +# MUST set TESTDIR before calling those functions + +test_before_apps() { + local out + + # BEFORE application is spawned + create_lttng_session $SESSION_NAME $TRACE_PATH + enable_ust_lttng_event $SESSION_NAME $EVENT_NAME + start_lttng_tracing $SESSION_NAME + # Start test + echo -n "Starting application... " + ./$CURDIR/gen-nevents $NR_ITER + echo -n "Ended " + print_ok + stop_lttng_tracing $SESSION_NAME + destroy_lttng_session $SESSION_NAME + + trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH + + return $? +} + +test_after_apps() { + local out + + echo -n "Starting application... " + ./$CURDIR/gen-nevents 100 & + print_ok + + # BEFORE application is spawned + create_lttng_session $SESSION_NAME $TRACE_PATH + enable_ust_lttng_event $SESSION_NAME $EVENT_NAME + start_lttng_tracing $SESSION_NAME + + # At least hit one event + sleep 2 + + stop_lttng_tracing $SESSION_NAME + destroy_lttng_session $SESSION_NAME + + out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) + if [ $out -eq 0 ]; then + echo -n "No event found. Suppose to have at least one... " + print_fail + out=1 + else + echo -n "Found $out event(s). Coherent... " + print_ok + out=0 + fi + + return $out +} + +# MUST set TESTDIR before calling those functions + +start_lttng_sessiond + +echo "" +echo "=== Start application BEFORE tracing was started ===" + +TRACE_PATH=$(mktemp -d) + +test_before_apps +out=$? +if [ $out -ne 0 ]; then + stop_lttng_sessiond + exit $out +fi + +rm -rf $TRACE_PATH + +echo "" +echo "=== Start application AFTER tracing was started ===" + +TRACE_PATH=$(mktemp -d) + +test_after_apps +out=$? +if [ $out -ne 0 ]; then + stop_lttng_sessiond + exit $out +fi + +stop_lttng_sessiond + +rm -rf $TRACE_PATH diff --git a/tests/regression/ust/high-throughput/Makefile.am b/tests/regression/ust/high-throughput/Makefile.am index cff8fe423..544640469 100644 --- a/tests/regression/ust/high-throughput/Makefile.am +++ b/tests/regression/ust/high-throughput/Makefile.am @@ -12,5 +12,5 @@ noinst_PROGRAMS = gen-events gen_events_SOURCES = main.c tp.c tp.h gen_events_LDADD = -llttng-ust -noinst_SCRIPTS = run -EXTRA_DIST = run +noinst_SCRIPTS = test_high_throughput +EXTRA_DIST = test_high_throughput diff --git a/tests/regression/ust/high-throughput/run b/tests/regression/ust/high-throughput/run deleted file mode 100755 index 550607328..000000000 --- a/tests/regression/ust/high-throughput/run +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# Copyright (C) - 2012 David Goulet -# -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -TEST_DESC="UST tracer - Testing high events throughput" - -CURDIR=$(dirname $0)/ -TESTDIR=$CURDIR/../../.. -NR_ITER=20 -BIN_NAME="gen-events" -SESSION_NAME="high-throughput" -EVENT_NAME="tp:tptest" - -source $TESTDIR/utils/utils.sh - -print_test_banner "$TEST_DESC" - -if [ ! -x "$CURDIR/$BIN_NAME" ]; then - echo -e "No UST nevents binary detected. Passing." - exit 0 -fi - -TRACE_PATH=$(mktemp -d) - -# MUST set TESTDIR before calling those functions - -start_lttng_sessiond - -create_lttng_session $SESSION_NAME $TRACE_PATH - -enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_lttng_tracing $SESSION_NAME - -for i in `seq 1 $NR_ITER`; do - ./$CURDIR/$BIN_NAME & >/dev/null 2>&1 -done - -echo "Waiting for applications to end" -while [ -n "$(pidof $BIN_NAME)" ]; do - echo -n "." - sleep 0.5 -done -echo "" - -stop_lttng_tracing $SESSION_NAME -destroy_lttng_session $SESSION_NAME - -stop_lttng_sessiond - -# Validate test - -TEMP_FILE=$(mktemp) -TEMP_FILE_2=$(mktemp) - -traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) -babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 - -cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE - -dropped=0 -while read line; -do - let dropped=$dropped+$line -done < $TEMP_FILE - -let total=$dropped+$traced -let wanted=$NR_ITER*1000000 - -if [ $wanted -ne $total ]; then - echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " - print_fail - out=1 -else - echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " - print_ok - out=0 -fi - -rm -rf $TRACE_PATH -rm $TEMP_FILE $TEMP_FILE_2 - -exit $out diff --git a/tests/regression/ust/high-throughput/test_high_throughput b/tests/regression/ust/high-throughput/test_high_throughput new file mode 100755 index 000000000..550607328 --- /dev/null +++ b/tests/regression/ust/high-throughput/test_high_throughput @@ -0,0 +1,94 @@ +#!/bin/bash +# +# Copyright (C) - 2012 David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Testing high events throughput" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../../.. +NR_ITER=20 +BIN_NAME="gen-events" +SESSION_NAME="high-throughput" +EVENT_NAME="tp:tptest" + +source $TESTDIR/utils/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -x "$CURDIR/$BIN_NAME" ]; then + echo -e "No UST nevents binary detected. Passing." + exit 0 +fi + +TRACE_PATH=$(mktemp -d) + +# MUST set TESTDIR before calling those functions + +start_lttng_sessiond + +create_lttng_session $SESSION_NAME $TRACE_PATH + +enable_ust_lttng_event $SESSION_NAME $EVENT_NAME +start_lttng_tracing $SESSION_NAME + +for i in `seq 1 $NR_ITER`; do + ./$CURDIR/$BIN_NAME & >/dev/null 2>&1 +done + +echo "Waiting for applications to end" +while [ -n "$(pidof $BIN_NAME)" ]; do + echo -n "." + sleep 0.5 +done +echo "" + +stop_lttng_tracing $SESSION_NAME +destroy_lttng_session $SESSION_NAME + +stop_lttng_sessiond + +# Validate test + +TEMP_FILE=$(mktemp) +TEMP_FILE_2=$(mktemp) + +traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) +babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 + +cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE + +dropped=0 +while read line; +do + let dropped=$dropped+$line +done < $TEMP_FILE + +let total=$dropped+$traced +let wanted=$NR_ITER*1000000 + +if [ $wanted -ne $total ]; then + echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " + print_fail + out=1 +else + echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " + print_ok + out=0 +fi + +rm -rf $TRACE_PATH +rm $TEMP_FILE $TEMP_FILE_2 + +exit $out diff --git a/tests/regression/ust/low-throughput/Makefile.am b/tests/regression/ust/low-throughput/Makefile.am index a1df9f5e2..e62706007 100644 --- a/tests/regression/ust/low-throughput/Makefile.am +++ b/tests/regression/ust/low-throughput/Makefile.am @@ -12,5 +12,5 @@ noinst_PROGRAMS = gen-events gen_events_SOURCES = main.c tp.c tp.h gen_events_LDADD = -llttng-ust -lurcu -noinst_SCRIPTS = run -EXTRA_DIST = run +noinst_SCRIPTS = test_low_throughput +EXTRA_DIST = test_low_throughput diff --git a/tests/regression/ust/low-throughput/run b/tests/regression/ust/low-throughput/run deleted file mode 100755 index 2e111336e..000000000 --- a/tests/regression/ust/low-throughput/run +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -# -# Copyright (C) - 2012 David Goulet -# -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -TEST_DESC="UST tracer - Testing low events throughput" - -CURDIR=$(dirname $0)/ -TESTDIR=$CURDIR/../../.. -BIN_NAME="gen-events" -SESSION_NAME="low-throughput" -EVENT_NAME="tp:slow" - -source $TESTDIR/utils/utils.sh - -print_test_banner "$TEST_DESC" - -if [ ! -x "$CURDIR/$BIN_NAME" ]; then - echo -e "No UST nevents binary detected. Passing." - exit 0 -fi - -TRACE_PATH=$(mktemp -d) - -# MUST set TESTDIR before calling those functions - -start_lttng_sessiond - -create_lttng_session $SESSION_NAME $TRACE_PATH - -enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_lttng_tracing $SESSION_NAME - -# This is going to take 20 minutes -./$CURDIR/$BIN_NAME >/dev/null 2>&1 - -stop_lttng_tracing $SESSION_NAME -destroy_lttng_session $SESSION_NAME - -stop_lttng_sessiond - -# Validate test - -last_val=0 -out=0 - -babeltrace $TRACE_PATH | while read event; -do - val=$(echo $event | cut -f10 -d" ") - val=${val%?} - th=$(echo $event | cut -f13 -d " ") - - if [ $th = '"one"' ]; then - ((last_val++)) - # We expect here a continous value from 1 to 20 - if [ $last_val -ne $val ]; then - echo -n "[-] One minute event failed ($val) " - out=1 - break - fi - elif [ $th = '"ten"' ]; then - # Test 10 minutes counter - if [ $val -ne 10 ]; then - # Test 20 minutes counter - if [ $val -ne 20 ]; then - echo -n "[-] Ten minutes event failed ($val) " - out=1 - break - fi - fi - elif [ $th = '"twenty"' ]; then - # Test 20 minutes counter - if [ $val -ne 20 ]; then - echo -n "[-] Twenty minutes event failed ($val) " - out=1 - break - fi - fi -done - -if [ $out -eq 0 ]; then - echo -n "Trace is coherent... " - print_ok -else - print_fail -fi - -rm -rf $TRACE_PATH - -exit $out diff --git a/tests/regression/ust/low-throughput/test_low_throughput b/tests/regression/ust/low-throughput/test_low_throughput new file mode 100755 index 000000000..2e111336e --- /dev/null +++ b/tests/regression/ust/low-throughput/test_low_throughput @@ -0,0 +1,101 @@ +#!/bin/bash +# +# Copyright (C) - 2012 David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Testing low events throughput" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../../.. +BIN_NAME="gen-events" +SESSION_NAME="low-throughput" +EVENT_NAME="tp:slow" + +source $TESTDIR/utils/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -x "$CURDIR/$BIN_NAME" ]; then + echo -e "No UST nevents binary detected. Passing." + exit 0 +fi + +TRACE_PATH=$(mktemp -d) + +# MUST set TESTDIR before calling those functions + +start_lttng_sessiond + +create_lttng_session $SESSION_NAME $TRACE_PATH + +enable_ust_lttng_event $SESSION_NAME $EVENT_NAME +start_lttng_tracing $SESSION_NAME + +# This is going to take 20 minutes +./$CURDIR/$BIN_NAME >/dev/null 2>&1 + +stop_lttng_tracing $SESSION_NAME +destroy_lttng_session $SESSION_NAME + +stop_lttng_sessiond + +# Validate test + +last_val=0 +out=0 + +babeltrace $TRACE_PATH | while read event; +do + val=$(echo $event | cut -f10 -d" ") + val=${val%?} + th=$(echo $event | cut -f13 -d " ") + + if [ $th = '"one"' ]; then + ((last_val++)) + # We expect here a continous value from 1 to 20 + if [ $last_val -ne $val ]; then + echo -n "[-] One minute event failed ($val) " + out=1 + break + fi + elif [ $th = '"ten"' ]; then + # Test 10 minutes counter + if [ $val -ne 10 ]; then + # Test 20 minutes counter + if [ $val -ne 20 ]; then + echo -n "[-] Ten minutes event failed ($val) " + out=1 + break + fi + fi + elif [ $th = '"twenty"' ]; then + # Test 20 minutes counter + if [ $val -ne 20 ]; then + echo -n "[-] Twenty minutes event failed ($val) " + out=1 + break + fi + fi +done + +if [ $out -eq 0 ]; then + echo -n "Trace is coherent... " + print_ok +else + print_fail +fi + +rm -rf $TRACE_PATH + +exit $out diff --git a/tests/regression/ust/multi-session/Makefile.am b/tests/regression/ust/multi-session/Makefile.am index d197d72f5..2d978e593 100644 --- a/tests/regression/ust/multi-session/Makefile.am +++ b/tests/regression/ust/multi-session/Makefile.am @@ -12,5 +12,5 @@ noinst_PROGRAMS = gen-nevents gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h gen_nevents_LDADD = -llttng-ust -noinst_SCRIPTS = run -EXTRA_DIST = run +noinst_SCRIPTS = test_multi_session +EXTRA_DIST = test_multi_session diff --git a/tests/regression/ust/multi-session/run b/tests/regression/ust/multi-session/run deleted file mode 100755 index 18e220dcf..000000000 --- a/tests/regression/ust/multi-session/run +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Copyright (C) - 2012 David Goulet -# -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -TEST_DESC="UST tracer - Multi-session" - -CURDIR=$(dirname $0)/ -TESTDIR=$CURDIR/../../.. -NR_ITER=100 -SESSION_NAME="multi-session" -EVENT_NAME="ust_gen_nevents:tptest" - -source $TESTDIR/utils/utils.sh - -print_test_banner "$TEST_DESC" - -if [ ! -x "$CURDIR/gen-nevents" ]; then - echo -e "No UST nevents binary detected. Passing." - exit 0 -fi - -# MUST set TESTDIR before calling those functions - -test_multi_session() { - local out - - # BEFORE application is spawned - for i in `seq 0 3`; do - create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i" - enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i" - start_lttng_tracing "$SESSION_NAME-$i" - done - - echo -n "Starting application generating $NR_ITER events... " - ./$CURDIR/gen-nevents $NR_ITER & - print_ok - - # At least hit one event - echo -n "Waiting for events to record " - while [ -n "$(pidof gen-nevents)" ]; do - echo -n "." - sleep 0.1 - done - print_ok - - for i in `seq 0 3`; do - stop_lttng_tracing "$SESSION_NAME-$i" - destroy_lttng_session "$SESSION_NAME-$i" - out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) - if [ $out -ne $NR_ITER ]; then - echo -n "No event found. Suppose to have at least one... " - print_fail - out=1 - else - echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... " - print_ok - out=0 - fi - done - - return $out -} - -# MUST set TESTDIR before calling those functions - -start_lttng_sessiond - -TRACE_PATH=$(mktemp -d) - -test_multi_session -out=$? -if [ $out -ne 0 ]; then - stop_lttng_sessiond - exit $out -fi - -stop_lttng_sessiond - -rm -rf "$TRACE_PATH" diff --git a/tests/regression/ust/multi-session/test_multi_session b/tests/regression/ust/multi-session/test_multi_session new file mode 100755 index 000000000..18e220dcf --- /dev/null +++ b/tests/regression/ust/multi-session/test_multi_session @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Copyright (C) - 2012 David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Multi-session" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../../.. +NR_ITER=100 +SESSION_NAME="multi-session" +EVENT_NAME="ust_gen_nevents:tptest" + +source $TESTDIR/utils/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -x "$CURDIR/gen-nevents" ]; then + echo -e "No UST nevents binary detected. Passing." + exit 0 +fi + +# MUST set TESTDIR before calling those functions + +test_multi_session() { + local out + + # BEFORE application is spawned + for i in `seq 0 3`; do + create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i" + enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i" + start_lttng_tracing "$SESSION_NAME-$i" + done + + echo -n "Starting application generating $NR_ITER events... " + ./$CURDIR/gen-nevents $NR_ITER & + print_ok + + # At least hit one event + echo -n "Waiting for events to record " + while [ -n "$(pidof gen-nevents)" ]; do + echo -n "." + sleep 0.1 + done + print_ok + + for i in `seq 0 3`; do + stop_lttng_tracing "$SESSION_NAME-$i" + destroy_lttng_session "$SESSION_NAME-$i" + out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) + if [ $out -ne $NR_ITER ]; then + echo -n "No event found. Suppose to have at least one... " + print_fail + out=1 + else + echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... " + print_ok + out=0 + fi + done + + return $out +} + +# MUST set TESTDIR before calling those functions + +start_lttng_sessiond + +TRACE_PATH=$(mktemp -d) + +test_multi_session +out=$? +if [ $out -ne 0 ]; then + stop_lttng_sessiond + exit $out +fi + +stop_lttng_sessiond + +rm -rf "$TRACE_PATH" diff --git a/tests/regression/ust/nprocesses/Makefile.am b/tests/regression/ust/nprocesses/Makefile.am index b07ae0baa..63a320954 100644 --- a/tests/regression/ust/nprocesses/Makefile.am +++ b/tests/regression/ust/nprocesses/Makefile.am @@ -12,5 +12,5 @@ noinst_PROGRAMS = gen-events-time gen_events_time_SOURCES = gen-events-time.c tp.c ust_gen_event.h gen_events_time_LDADD = -llttng-ust -noinst_SCRIPTS = run ust-nprocesses -EXTRA_DIST = run ust-nprocesses +noinst_SCRIPTS = test_nprocesses ust-nprocesses +EXTRA_DIST = test_nprocesses ust-nprocesses diff --git a/tests/regression/ust/nprocesses/run b/tests/regression/ust/nprocesses/run deleted file mode 100755 index 55ad14811..000000000 --- a/tests/regression/ust/nprocesses/run +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# Copyright (C) - 2012 David Goulet -# -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -NR_ITER=100 -TEST_DESC="UST tracer - Generate $NR_ITER process" - -CURDIR=$(dirname $0)/ -TESTDIR=$CURDIR/../../.. -TEST_BIN_NAME="gen-events-time" - -source $TESTDIR/utils/utils.sh - -print_test_banner "$TEST_DESC" - -if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then - echo -e "No UST $TEST_BIN_NAME binary detected. Passing." - exit 0 -fi - -# MUST set TESTDIR before calling those functions - -start_lttng_sessiond - -./$CURDIR/ust-nprocesses $NR_ITER - -stop_lttng_sessiond - -exit 0 diff --git a/tests/regression/ust/nprocesses/test_nprocesses b/tests/regression/ust/nprocesses/test_nprocesses new file mode 100755 index 000000000..55ad14811 --- /dev/null +++ b/tests/regression/ust/nprocesses/test_nprocesses @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) - 2012 David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +NR_ITER=100 +TEST_DESC="UST tracer - Generate $NR_ITER process" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../../.. +TEST_BIN_NAME="gen-events-time" + +source $TESTDIR/utils/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then + echo -e "No UST $TEST_BIN_NAME binary detected. Passing." + exit 0 +fi + +# MUST set TESTDIR before calling those functions + +start_lttng_sessiond + +./$CURDIR/ust-nprocesses $NR_ITER + +stop_lttng_sessiond + +exit 0 diff --git a/tests/regression/ust/overlap/Makefile.am b/tests/regression/ust/overlap/Makefile.am index 7100034f9..d90146f9f 100644 --- a/tests/regression/ust/overlap/Makefile.am +++ b/tests/regression/ust/overlap/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS = demo -noinst_SCRIPTS = run -EXTRA_DIST = run overlap.sh +noinst_SCRIPTS = test_overlap +EXTRA_DIST = test_overlap overlap.sh diff --git a/tests/regression/ust/overlap/run b/tests/regression/ust/overlap/run deleted file mode 100755 index ca8efb34f..000000000 --- a/tests/regression/ust/overlap/run +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -tests=( $DIR/overlap.sh) - -exit_code=0 - -function start_tests () -{ - for bin in ${tests[@]}; - do - ./$bin - # Test must return 0 to pass. - if [ $? -ne 0 ]; then - exit_code=1 - break - fi - done -} - -start_tests - -exit $exit_code diff --git a/tests/regression/ust/overlap/test_overlap b/tests/regression/ust/overlap/test_overlap new file mode 100755 index 000000000..ca8efb34f --- /dev/null +++ b/tests/regression/ust/overlap/test_overlap @@ -0,0 +1,24 @@ +#!/bin/bash + +DIR=$(dirname $0) + +tests=( $DIR/overlap.sh) + +exit_code=0 + +function start_tests () +{ + for bin in ${tests[@]}; + do + ./$bin + # Test must return 0 to pass. + if [ $? -ne 0 ]; then + exit_code=1 + break + fi + done +} + +start_tests + +exit $exit_code diff --git a/tests/regression/ust/runall.sh b/tests/regression/ust/runall.sh index 01afceca7..89aa3bb3b 100755 --- a/tests/regression/ust/runall.sh +++ b/tests/regression/ust/runall.sh @@ -2,9 +2,9 @@ DIR=$(dirname $0) -tests=( $DIR/run-ust-global-tests.sh $DIR/nprocesses/run \ - $DIR/high-throughput/run $DIR/before-after/run \ - $DIR/multi-session/run $DIR/overlap/run ) +tests=( $DIR/run-ust-global-tests.sh $DIR/nprocesses/test_nprocesses \ + $DIR/high-throughput/test_high_throughput $DIR/before-after/test_before_after \ + $DIR/multi-session/test_multi_session $DIR/overlap/test_overlap ) # $DIR/low-throughput/run --> DEACTIVATED. # Use only for release. This test last 20 minutes