From 7fe98a985f6fddf7eba195c138fad23339676979 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 17 Aug 2018 13:25:16 -0400 Subject: [PATCH] Tests: add notap versions of start/stop tracing helpers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- tests/regression/tools/crash/test_crash | 4 +- .../notification/test_notification_multi_app | 2 +- tests/utils/utils.sh | 50 +++++++++++++------ 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/tests/regression/tools/crash/test_crash b/tests/regression/tools/crash/test_crash index 5b9a27c58..3bf459dc2 100755 --- a/tests/regression/tools/crash/test_crash +++ b/tests/regression/tools/crash/test_crash @@ -229,7 +229,7 @@ function test_lttng_crash() # Generate 10 events $TESTAPP_BIN 10 0 - stop_lttng_tracing + stop_lttng_tracing_ok crash_recup_count=$($LTTNG_CRASH $shm_path | wc -l) test $crash_recup_count -eq "10" @@ -267,7 +267,7 @@ function test_lttng_crash_extraction() start_lttng_tracing_ok $session_name # Generate 10 events $TESTAPP_BIN 10 0 - stop_lttng_tracing + stop_lttng_tracing_ok $LTTNG_CRASH -x $extraction_path $shm_path ok $? "Extraction of crashed buffers to path" diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app index eca9688cf..7465a83f8 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -265,7 +265,7 @@ function test_multi_app () resume_consumerd "${pipe}" done # Stop tracing forcing full buffer consumption - stop_lttng_tracing $SESSION_NAME + stop_lttng_tracing_ok $SESSION_NAME # Check for notifications reception wait_for_message $output_dir "${low_output_file_pattern}" "notification: low $i" diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 2d53a7237..2343b4b28 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -1081,54 +1081,76 @@ function disable_python_lttng_event () ok $? "Disable Python event $event_name for session $sess_name" } -function start_lttng_tracing () +function start_lttng_tracing_opt () { - local expected_to_fail=$1 - local sess_name=$2 + local withtap=$1 + local expected_to_fail=$2 + local sess_name=$3 $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST ret=$? if [[ $expected_to_fail -eq "1" ]]; then test "$ret" -ne "0" - ok $? "Start tracing for session $sess_name failed as expected" + ret=$? + if [ $withtap -eq "1" ]; then + ok $? "Start tracing for session $sess_name failed as expected" + fi else - ok $ret "Start tracing for session $sess_name" + if [ $withtap -eq "1" ]; then + ok $ret "Start tracing for session $sess_name" + fi fi } function start_lttng_tracing_ok () { - start_lttng_tracing 0 "$@" + start_lttng_tracing_opt 1 0 "$@" } function start_lttng_tracing_fail () { - start_lttng_tracing 1 "$@" + start_lttng_tracing_opt 1 1 "$@" } -function stop_lttng_tracing () +function start_lttng_tracing_notap () { - local expected_to_fail=$1 - local sess_name=$2 + start_lttng_tracing_opt 0 1 "$@" +} + +function stop_lttng_tracing_opt () +{ + local withtap=$1 + local expected_to_fail=$2 + local sess_name=$3 $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST ret=$? if [[ $expected_to_fail -eq "1" ]]; then test "$ret" -ne "0" - ok $? "Stop lttng tracing for session $sess_name failed as expected" + ret=$? + if [ $withtap -eq "1" ]; then + ok $? "Stop lttng tracing for session $sess_name failed as expected" + fi else - ok $ret "Stop lttng tracing for session $sess_name" + if [ $withtap -eq "1" ]; then + ok $ret "Stop lttng tracing for session $sess_name" + fi fi } function stop_lttng_tracing_ok () { - stop_lttng_tracing 0 "$@" + stop_lttng_tracing_opt 1 0 "$@" } function stop_lttng_tracing_fail () { - stop_lttng_tracing 1 "$@" + stop_lttng_tracing_opt 1 1 "$@" +} + +function stop_lttng_tracing_notap () +{ + stop_lttng_tracing_opt 0 0 "$@" } function destroy_lttng_session () -- 2.34.1