Cleanup: Tests: remove trace after test
[lttng-tools.git] / tests / regression / tools / channel / test_channel
CommitLineData
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
7TEST_DESC="LTTng - Channel tests"
8
9CURDIR=$(dirname $0)/
10TESTDIR=$CURDIR/../../..
11TESTAPP_PATH="$TESTDIR/utils/testapp"
12TESTAPP_NAME="gen-ust-events"
13TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
14NR_ITER=100
15NR_USEC_WAIT=1
16NUM_TESTS=14
17
18source $TESTDIR/utils/utils.sh
19
20function 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
63plan_tests $NUM_TESTS
64
65print_test_banner "$TEST_DESC"
66
67start_lttng_sessiond
68
69if [ ! -x "$TESTAPP_BIN" ]; then
70 BAIL_OUT "No UST nevents binary detected."
71fi
72
73test_channel_disable_stopped_session
74
75stop_lttng_sessiond
This page took 0.033989 seconds and 4 git commands to generate.