Commit | Line | Data |
---|---|---|
1b368955 JD |
1 | #!/bin/bash |
2 | # | |
9d16b343 MJ |
3 | # Copyright (C) 2013 Julien Desfossez <julien.desfossez@efficios.com> |
4 | # Copyright (C) 2013 David Goulet <dgoulet@efficios.com> | |
1b368955 | 5 | # |
9d16b343 | 6 | # SPDX-License-Identifier: LGPL-2.1-only |
1b368955 JD |
7 | |
8 | TEST_DESC="Live - User space tracing" | |
9 | ||
10 | CURDIR=$(dirname $0)/ | |
11 | TESTDIR=$CURDIR/../../../ | |
1b368955 JD |
12 | NR_ITER=1 |
13 | NR_USEC_WAIT=1 | |
14 | DELAY_USEC=2000000 | |
15 | TESTAPP_PATH="$TESTDIR/utils/testapp" | |
16 | TESTAPP_NAME="gen-ust-events" | |
17 | TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" | |
18 | ||
19 | SESSION_NAME="live" | |
20 | EVENT_NAME="tp:tptest" | |
21 | ||
33e55711 | 22 | TRACE_PATH=$(mktemp --tmpdir -d tmp.test_test_live_lttng_ust_trace_path.XXXXXX) |
1b368955 JD |
23 | |
24 | DIR=$(readlink -f $TESTDIR) | |
25 | ||
a9c920d9 | 26 | NUM_TESTS=11 |
1b368955 JD |
27 | |
28 | source $TESTDIR/utils/utils.sh | |
29 | ||
30 | # MUST set TESTDIR before calling those functions | |
31 | plan_tests $NUM_TESTS | |
32 | ||
33 | print_test_banner "$TEST_DESC" | |
c125de8f FD |
34 | |
35 | bail_out_if_no_babeltrace | |
1b368955 | 36 | |
1a241656 DG |
37 | function test_custom_url() |
38 | { | |
39 | # Create session with custom URL | |
40 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \ | |
41 | -C tcp://localhost:1819 -D tcp://localhost:9187 >/dev/null 2>&1 | |
42 | ok $? "Create session in live mode with delay $DELAY_USEC and custom URLs" | |
43 | } | |
44 | ||
1b368955 JD |
45 | function setup_live_tracing() |
46 | { | |
47 | # Create session with default path | |
48 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \ | |
49 | -U net://localhost >/dev/null 2>&1 | |
50 | ok $? "Create session in live mode with delay $DELAY_USEC" | |
51 | ||
c4926bb5 | 52 | enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME |
e563bbdb | 53 | start_lttng_tracing_ok $SESSION_NAME |
1b368955 JD |
54 | } |
55 | ||
56 | function clean_live_tracing() | |
57 | { | |
96340a01 | 58 | stop_lttng_tracing_ok $SESSION_NAME |
67b4c664 | 59 | destroy_lttng_session_ok $SESSION_NAME |
1b368955 JD |
60 | } |
61 | ||
62 | start_lttng_sessiond | |
63 | start_lttng_relayd "-o $TRACE_PATH" | |
64 | ||
65 | setup_live_tracing | |
66 | ||
6c4a91d6 | 67 | $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 |
1b368955 JD |
68 | |
69 | clean_live_tracing | |
70 | ||
d53addeb | 71 | trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH |
1b368955 | 72 | rm -rf $TRACE_PATH |
1b368955 | 73 | stop_lttng_relayd |
1a241656 DG |
74 | |
75 | test_custom_url | |
1a241656 | 76 | |
1b368955 | 77 | stop_lttng_sessiond |