X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=5ffe6eb47ad8da6836e3e183356cb09066360033;hp=a0c9940ac90bcff283863f286b1fce03fa326866;hb=8dcef147f49823d92c8fcd0914bf038c5d0eab40;hpb=3e81c0f2fcfb479413c71a73e4de25bcdb6b198d diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index a0c9940ac..5ffe6eb47 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -1017,6 +1017,44 @@ function lttng_untrack_fail() lttng_untrack 1 "$@" } +function add_context_lttng() +{ + local expected_to_fail="$1" + local domain="$2" + local session_name="$3" + local channel_name="$4" + local type="$5" + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN add-context -s $session_name -c $channel_name -t $type $domain 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST + ret=$? + if [[ $expected_to_fail -eq "1" ]]; then + test $ret -ne "0" + ok $? "Add context command failed as expected for type: $type" + else + ok $ret "Add context command for type: $type" + fi +} + +function add_context_ust_ok() +{ + add_context_lttng 0 -u "$@" +} + +function add_context_ust_fail() +{ + add_context_lttng 1 -u "$@" +} + +function add_context_kernel_ok() +{ + add_context_lttng 0 -k "$@" +} + +function add_context_kernel_fail() +{ + add_context_lttng 1 -k "$@" +} + function trace_matches () { local event_name=$1