3 # Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
5 # SPDX-License-Identifier: GPL-2.0-only
7 TEST_DESC
="LTTng - Channel tests"
10 TESTDIR
=$CURDIR/..
/..
/..
11 TESTAPP_PATH
="$TESTDIR/utils/testapp"
12 TESTAPP_NAME
="gen-ust-events"
13 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
18 source $TESTDIR/utils
/utils.sh
20 function test_channel_disable_stopped_session
()
22 local TRACE_PATH
=$
(mktemp
-d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
23 local SESSION_NAME
="test_channel"
24 local CHAN_NAME
="channel0"
25 local EVENT_NAME
="tp:tptest"
27 diag
"Test channel disable on stop session"
29 create_lttng_session_ok
"$SESSION_NAME" "$TRACE_PATH"
31 enable_ust_lttng_channel_ok
"$SESSION_NAME" "$CHAN_NAME"
33 enable_ust_lttng_event_ok
"$SESSION_NAME" "$EVENT_NAME" "$CHAN_NAME"
35 start_lttng_tracing_ok
"$SESSION_NAME"
37 "$TESTAPP_BIN" -i "$NR_ITER" -w "$NR_USEC_WAIT"
39 stop_lttng_tracing_ok
"$SESSION_NAME"
41 trace_match_only
"$EVENT_NAME" "$NR_ITER" "$TRACE_PATH"
43 lttng_clear_session_ok
"$SESSION_NAME"
45 disable_ust_lttng_channel
"$SESSION_NAME" "$CHAN_NAME"
47 start_lttng_tracing_ok
"$SESSION_NAME"
49 # The channel is disabled so no events should be emited by this app.
50 "$TESTAPP_BIN" -i "$NR_ITER" -w "$NR_USEC_WAIT"
52 stop_lttng_tracing_ok
"$SESSION_NAME"
54 trace_match_only
"$EVENT_NAME" 0 "$TRACE_PATH"
56 destroy_lttng_session_ok
$SESSION_NAME
62 # MUST set TESTDIR before calling those functions
65 print_test_banner
"$TEST_DESC"
67 bail_out_if_no_babeltrace
71 if [ ! -x "$TESTAPP_BIN" ]; then
72 BAIL_OUT
"No UST nevents binary detected."
75 test_channel_disable_stopped_session