From: Jonathan Rajotte Date: Thu, 23 Apr 2015 21:22:36 +0000 (-0400) Subject: Refactor: test: wrapper for enable_ust_lttng_channel X-Git-Tag: v2.7.0-rc1~23 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=827caf52170780e09de9184749067ef670801846;p=lttng-tools.git Refactor: test: wrapper for enable_ust_lttng_channel 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 620b53cf7..6ec2760cd 100755 --- a/tests/regression/tools/mi/test_mi +++ b/tests/regression/tools/mi/test_mi @@ -246,20 +246,20 @@ function test_ust_channel () #Test the enable_channel command OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE - enable_ust_lttng_channel $session_name ${channel_name[0]} + enable_ust_lttng_channel_ok $session_name ${channel_name[0]} $XML_VALIDATE $OUTPUT_DEST ok $? "Mi test: enable ust channel xsd validation" is_command_success $OUTPUT_DEST false #Expect the command to fail - enable_ust_lttng_channel $session_name ${channel_name[0]} true + enable_ust_lttng_channel_fail $session_name ${channel_name[0]} $XML_VALIDATE $OUTPUT_DEST ok $? "Mi test: fail enable ust channel xsd validation" is_command_success $OUTPUT_DEST true #Create two ust channel to test multiple disable for (( i = 1; i < 3; i++ )); do - enable_ust_lttng_channel $session_name ${channel_name[$i]} + enable_ust_lttng_channel_ok $session_name ${channel_name[$i]} done #Test the disable_channel command @@ -301,7 +301,7 @@ function test_ust_lttng_event () #Test build up OUTPUT_DEST=$DEVNULL create_lttng_session_ok $session_name $OUTPUT_DIR - enable_ust_lttng_channel $session_name $channel_name + enable_ust_lttng_channel_ok $session_name $channel_name OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE #Test the enable event for ust domain @@ -373,7 +373,7 @@ function test_list_channel () #Test buid up OUTPUT_DEST=$DEVNULL create_lttng_session_ok $session_name $OUTPUT_DIR - enable_ust_lttng_channel $session_name $channel_name + enable_ust_lttng_channel_ok $session_name $channel_name #Enable ust and jul events concat_event=$( IFS=$','; echo "${event[*]}" ) @@ -402,7 +402,7 @@ function test_list_channel () #Add a channel and make sure we have 2 channel now OUTPUT_DEST=$DEVNULL - enable_ust_lttng_channel $session_name $channel_name"a" + enable_ust_lttng_channel_ok $session_name $channel_name"a" #Teardown OUTPUT_DEST=$DEVNULL @@ -420,7 +420,7 @@ function test_list_domain () #Test buid up OUTPUT_DEST=$DEVNULL create_lttng_session_ok $session_name $OUTPUT_DIR - enable_ust_lttng_channel $session_name $channel_name + enable_ust_lttng_channel_ok $session_name $channel_name #Enable ust and jul events concat_event=$( IFS=$','; echo "${event[*]}" ) @@ -468,7 +468,7 @@ function test_list_session () #Test buid up OUTPUT_DEST=$DEVNULL create_lttng_session_ok $session_name $OUTPUT_DIR - enable_ust_lttng_channel $session_name $channel_name + enable_ust_lttng_channel_ok $session_name $channel_name #Enable ust and jul events concat_event=$( IFS=$','; echo "${event[*]}" ) @@ -556,7 +556,7 @@ function test_start_stop () { #Enable a channel to test success OUTPUT_DEST=$DEVNULL - enable_ust_lttng_channel $session_name $channel_name + enable_ust_lttng_channel_ok $session_name $channel_name #Start tracing OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE diff --git a/tests/regression/tools/save-load/test_save b/tests/regression/tools/save-load/test_save index abb2c5684..2994c9f6c 100755 --- a/tests/regression/tools/save-load/test_save +++ b/tests/regression/tools/save-load/test_save @@ -66,7 +66,7 @@ function test_basic_save() diag "Test basic save" create_lttng_session_ok $SESSION_NAME $TRACE_PATH - enable_ust_lttng_channel $SESSION_NAME $CHANNEL_NAME + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME lttng_save $SESSION_NAME "-o $TRACE_PATH" @@ -84,9 +84,9 @@ function test_basic_save_all() create_lttng_session_ok $SESSION_NAME-2 $TRACE_PATH create_lttng_session_ok $SESSION_NAME-3 $TRACE_PATH - enable_ust_lttng_channel $SESSION_NAME-1 $CHANNEL_NAME - enable_ust_lttng_channel $SESSION_NAME-2 $CHANNEL_NAME - enable_ust_lttng_channel $SESSION_NAME-3 $CHANNEL_NAME + enable_ust_lttng_channel_ok $SESSION_NAME-1 $CHANNEL_NAME + enable_ust_lttng_channel_ok $SESSION_NAME-2 $CHANNEL_NAME + enable_ust_lttng_channel_ok $SESSION_NAME-3 $CHANNEL_NAME enable_ust_lttng_event $SESSION_NAME-1 $EVENT_NAME $CHANNEL_NAME enable_ust_lttng_event $SESSION_NAME-2 $EVENT_NAME $CHANNEL_NAME @@ -108,7 +108,7 @@ function test_overwrite() diag "Test overwrite session file" create_lttng_session_ok $SESSION_NAME $TRACE_PATH - enable_ust_lttng_channel $SESSION_NAME $CHANNEL_NAME + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME lttng_save $SESSION_NAME "-o $TRACE_PATH" @@ -119,7 +119,7 @@ function test_overwrite() # Create a new session with same name so we can force the overwrite create_lttng_session_ok $SESSION_NAME $TRACE_PATH - enable_ust_lttng_channel $SESSION_NAME $CHANNEL_NAME + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME # This one MUST fail diff --git a/tests/regression/ust/test_event_basic b/tests/regression/ust/test_event_basic index 2b043ef0d..90be0e972 100755 --- a/tests/regression/ust/test_event_basic +++ b/tests/regression/ust/test_event_basic @@ -71,8 +71,8 @@ function test_event_basic() create_lttng_session_ok $SESSION_NAME $TRACE_PATH create_lttng_session_ok $SESSION_NAME2 $TRACE_PATH - enable_ust_lttng_channel $SESSION_NAME $CHAN_NAME - enable_ust_lttng_channel $SESSION_NAME2 $CHAN_NAME2 + enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME + enable_ust_lttng_channel_ok $SESSION_NAME2 $CHAN_NAME2 enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME2 $CHAN_NAME diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index a2131a0db..478ffb4e6 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -60,7 +60,7 @@ function test_event_basic() create_lttng_session_ok $SESSION_NAME $TRACE_PATH - enable_ust_lttng_channel $SESSION_NAME $CHAN_NAME + enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 12dabc52c..f44a7376f 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -393,15 +393,15 @@ function create_lttng_session_fail () } -function enable_ust_lttng_channel() +function enable_ust_lttng_channel () { - local sess_name=$1 - local channel_name=$2 - local expect_fail=$3 + local expect_fail=$1 + local sess_name=$2 + local channel_name=$3 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name >$OUTPUT_DEST ret=$? - if [[ $expect_fail ]]; then + if [[ $expect_fail -eq "1" ]]; then test "$ret" -ne "0" ok $? "Expected fail on ust channel creation $channel_name in $sess_name" else @@ -409,6 +409,16 @@ function enable_ust_lttng_channel() fi } +function enable_ust_lttng_channel_ok () +{ + enable_ust_lttng_channel 0 "$@" +} + +function enable_ust_lttng_channel_fail () +{ + enable_ust_lttng_channel 1 "$@" +} + function disable_ust_lttng_channel() { local sess_name=$1