Refactor: test: wrapper for lttng_snapshot_add_output
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 24 Apr 2015 20:45:08 +0000 (16:45 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 Jun 2015 21:55:58 +0000 (17:55 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/tools/mi/test_mi
tests/regression/tools/snapshots/test_kernel
tests/regression/tools/snapshots/ust_test
tests/utils/utils.sh

index 515c040df77ce91d979b8887ea428fe121e569ab..89ff4f23f9bc3196b034e97e7f0b45d8799afcd9 100755 (executable)
@@ -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"
 
index 9dac4596b0ce222bcc72001f8a46e33d65f44cb5..a590fb4d02178bba2175e8f8b809afae81c484b4 100755 (executable)
@@ -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
index 271eb139246d6595bcaf5d859c387b40fb55b6d3..f05846f3e34bf0840b9c840aa821d97847db96f8 100755 (executable)
@@ -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
index 454627eaae3ad6115b598f3067d1f81410899631..90589271b5cd19ac977acc933245c55fd03e766b 100644 (file)
@@ -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
This page took 0.038161 seconds and 4 git commands to generate.