tests: sync tests/utils/tap with Babeltrace repository
[lttng-tools.git] / tests / regression / ust / test_event_tracef
1 #!/bin/bash
2 #
3 # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
4 # Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 #
6 # SPDX-License-Identifier: GPL-2.0-only
7
8 TEST_DESC="UST tracer - tracef events"
9
10 CURDIR=$(dirname $0)/
11 TESTDIR=$CURDIR/../..
12 TESTAPP_PATH="$TESTDIR/utils/testapp"
13 TESTAPP_NAME="gen-ust-tracef"
14 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
15 SESSION_NAME="tracef"
16 EVENT_NAME="lttng_ust_tracef:event"
17 NUM_TESTS=9
18 NR_ITER=100
19
20 source $TESTDIR/utils/utils.sh
21
22 if [ ! -x "$TESTAPP_BIN" ]; then
23 BAIL_OUT "No UST nevents binary detected."
24 fi
25
26 function test_event_tracef()
27 {
28 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
29 enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
30 start_lttng_tracing_ok $SESSION_NAME
31
32 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
33 ok $? "Traced application stopped."
34
35 stop_lttng_tracing_ok $SESSION_NAME
36 destroy_lttng_session_ok $SESSION_NAME
37
38 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
39
40 return $?
41 }
42
43 # MUST set TESTDIR before calling those functions
44 plan_tests $NUM_TESTS
45
46 print_test_banner "$TEST_DESC"
47
48 bail_out_if_no_babeltrace
49
50 start_lttng_sessiond
51
52 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_event_tracef_trace_path.XXXXXX)
53 test_event_tracef
54 out=$?
55 if [ $out -ne 0 ]; then
56 stop_lttng_sessiond
57 exit $out
58 fi
59
60 stop_lttng_sessiond
61
62 rm -rf $TRACE_PATH
This page took 0.032523 seconds and 4 git commands to generate.