From: Jonathan Rajotte Date: Fri, 24 Apr 2015 20:45:08 +0000 (-0400) Subject: Refactor: test: wrapper for lttng_snapshot_add_output X-Git-Tag: v2.7.0-rc1~18 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b5633831f5bfbd7fa83ade17400d3965825eb65f;p=lttng-tools.git Refactor: test: wrapper for lttng_snapshot_add_output Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/tools/mi/test_mi b/tests/regression/tools/mi/test_mi index 515c040df..89ff4f23f 100755 --- a/tests/regression/tools/mi/test_mi +++ b/tests/regression/tools/mi/test_mi @@ -622,7 +622,7 @@ function test_snapshot () { #Test fail command #No channel enable start command should return element success false OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE - lttng_snapshot_add_output $session_name $snapshot_path + lttng_snapshot_add_output_ok $session_name $snapshot_path $XML_VALIDATE $OUTPUT_DEST ok $? "Mi test: snapshot xsd validation" diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel index 9dac4596b..a590fb4d0 100755 --- a/tests/regression/tools/snapshots/test_kernel +++ b/tests/regression/tools/snapshots/test_kernel @@ -42,7 +42,7 @@ function test_kernel_local_snapshot () enable_lttng_mmap_overwrite_kernel_channel $SESSION_NAME $CHANNEL_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH lttng_snapshot_record $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME @@ -65,7 +65,7 @@ function test_kernel_local_snapshot_after_stop () lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH lttng_snapshot_record $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME @@ -89,7 +89,7 @@ function test_kernel_local_snapshot_append_to_metadata () enable_lttng_mmap_overwrite_kernel_channel $SESSION_NAME $CHANNEL_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT1 $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH # first snapshot with only 1 event lttng_snapshot_record $SESSION_NAME @@ -127,7 +127,7 @@ function test_kernel_1000_local_snapshots () enable_lttng_mmap_overwrite_kernel_channel $SESSION_NAME $CHANNEL_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH for i in $(seq 1 $NB_SNAP); do diag "Snapshot $i/$NB_SNAP" rm -rf $TRACE_PATH/snapshot/* 2>/dev/null diff --git a/tests/regression/tools/snapshots/ust_test b/tests/regression/tools/snapshots/ust_test index 271eb1392..f05846f3e 100755 --- a/tests/regression/tools/snapshots/ust_test +++ b/tests/regression/tools/snapshots/ust_test @@ -160,7 +160,7 @@ function test_ust_local_snapshot () enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH # Returns once the application has at least fired ONE tracepoint. start_test_app @@ -239,7 +239,7 @@ function test_ust_local_snapshot_large_metadata () enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event_ok $SESSION_NAME $LM_EVENT $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH $LM_BIN 1 1 ok $? "Start application to trace" lttng_snapshot_record $SESSION_NAME @@ -270,7 +270,7 @@ function test_ust_per_uid_local_snapshot () enable_channel_per_uid_mmap_overwrite $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH # Returns once the application has at least fired ONE tracepoint. start_test_app @@ -296,7 +296,7 @@ function test_ust_per_uid_local_snapshot_post_mortem () enable_channel_per_uid_mmap_overwrite $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH # Returns once the application has at least fired ONE tracepoint. start_test_app @@ -321,7 +321,7 @@ function test_ust_local_snapshots () enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - lttng_snapshot_add_output $SESSION_NAME $TRACE_PATH + lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH # Returns once the application has at least fired ONE tracepoint. start_test_app diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 454627eaa..90589271b 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -744,13 +744,13 @@ function destroy_lttng_sessions () function lttng_snapshot_add_output () { - local sess_name=$1 - local trace_path=$2 - local expected_to_fail=$3 + local expected_to_fail=$1 + local sess_name=$2 + local trace_path=$3 $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name file://$trace_path >$OUTPUT_DEST ret=$? - if [[ $expected_to_fail ]]; then + if [[ $expected_to_fail -eq 1 ]]; then test "$ret" -ne "0" ok $? "Failed to add a snapshot output file://$trace_path as expected" else @@ -758,6 +758,16 @@ function lttng_snapshot_add_output () fi } +function lttng_snapshot_add_output_ok () +{ + lttng_snapshot_add_output 0 "$@" +} + +function lttng_snapshot_add_output_fail () +{ + lttng_snapshot_add_output 1 "$@" +} + function lttng_snapshot_del_output () { local sess_name=$1