Commit | Line | Data |
---|---|---|
fbee8987 FD |
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 | { | |
33e55711 | 22 | local TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") |
fbee8987 FD |
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 | start_lttng_sessiond | |
68 | ||
69 | if [ ! -x "$TESTAPP_BIN" ]; then | |
70 | BAIL_OUT "No UST nevents binary detected." | |
71 | fi | |
72 | ||
73 | test_channel_disable_stopped_session | |
74 | ||
75 | stop_lttng_sessiond |