a530b649dcaa55ce25fb88703df80e3ecfef9a70
[lttng-tools.git] / tests / regression / tools / channel / test_channel
1 #!/bin/bash
2 #
3 # Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
4 #
5 # SPDX-License-Identifier: GPL-2.0-only
6
7 TEST_DESC="LTTng - Channel tests"
8
9 CURDIR=$(dirname $0)/
10 TESTDIR=$CURDIR/../../..
11 TESTAPP_PATH="$TESTDIR/utils/testapp"
12 TESTAPP_NAME="gen-ust-events"
13 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
14 NR_ITER=100
15 NR_USEC_WAIT=1
16 NUM_TESTS=14
17
18 source $TESTDIR/utils/utils.sh
19
20 function test_channel_disable_stopped_session()
21 {
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"
26
27 diag "Test channel disable on stop session"
28
29 create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH"
30
31 enable_ust_lttng_channel_ok "$SESSION_NAME" "$CHAN_NAME"
32
33 enable_ust_lttng_event_ok "$SESSION_NAME" "$EVENT_NAME" "$CHAN_NAME"
34
35 start_lttng_tracing_ok "$SESSION_NAME"
36
37 "$TESTAPP_BIN" -i "$NR_ITER" -w "$NR_USEC_WAIT"
38
39 stop_lttng_tracing_ok "$SESSION_NAME"
40
41 trace_match_only "$EVENT_NAME" "$NR_ITER" "$TRACE_PATH"
42
43 lttng_clear_session_ok "$SESSION_NAME"
44
45 disable_ust_lttng_channel "$SESSION_NAME" "$CHAN_NAME"
46
47 start_lttng_tracing_ok "$SESSION_NAME"
48
49 # The channel is disabled so no events should be emited by this app.
50 "$TESTAPP_BIN" -i "$NR_ITER" -w "$NR_USEC_WAIT"
51
52 stop_lttng_tracing_ok "$SESSION_NAME"
53
54 trace_match_only "$EVENT_NAME" 0 "$TRACE_PATH"
55
56 destroy_lttng_session_ok $SESSION_NAME
57
58 rm -rf $TRACE_PATH
59 }
60
61
62 # MUST set TESTDIR before calling those functions
63 plan_tests $NUM_TESTS
64
65 print_test_banner "$TEST_DESC"
66
67 bail_out_if_no_babeltrace
68
69 start_lttng_sessiond
70
71 if [ ! -x "$TESTAPP_BIN" ]; then
72 BAIL_OUT "No UST nevents binary detected."
73 fi
74
75 test_channel_disable_stopped_session
76
77 stop_lttng_sessiond
This page took 0.030969 seconds and 4 git commands to generate.