Refactor: test: wrapper for enable_ust_lttng_event
[lttng-tools.git] / tests / utils / utils.sh
index 12dabc52ccd87a9bbd17372511186198fdcd0790..a8e0e4a0721926a9b183487b634d4b6812dae1c0 100644 (file)
@@ -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
@@ -438,10 +448,10 @@ function enable_lttng_mmap_overwrite_ust_channel()
 
 function enable_ust_lttng_event ()
 {
-       local sess_name=$1
-       local event_name="$2"
-       local channel_name=$3
-       local expected_to_fail=$4
+       local expected_to_fail=$1
+       local sess_name=$2
+       local event_name="$3"
+       local channel_name=$4
 
        if [ -z $channel_name ]; then
                # default channel if none specified
@@ -452,7 +462,7 @@ function enable_ust_lttng_event ()
 
        $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -u >$OUTPUT_DEST
        ret=$?
-       if [[ $expected_to_fail ]]; then
+       if [[ $expected_to_fail -eq "1" ]]; then
                test $ret -ne "0"
                ok $? "Enable ust event $event_name for session $session_name on channel $channel_name failed as expected"
        else
@@ -460,6 +470,16 @@ function enable_ust_lttng_event ()
        fi
 }
 
+function enable_ust_lttng_event_ok ()
+{
+       enable_ust_lttng_event 0 "$@"
+}
+
+function enable_ust_lttng_event_fail ()
+{
+       enable_ust_lttng_event 1 "$@"
+}
+
 function enable_jul_lttng_event()
 {
        sess_name=$1
This page took 0.024533 seconds and 4 git commands to generate.