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_live_ust_trace_path.XXXXXX) |
1b368955 JD |
23 | |
24 | DIR=$(readlink -f $TESTDIR) | |
25 | ||
26 | source $TESTDIR/utils/utils.sh | |
27 | ||
28 | echo "$TEST_DESC" | |
29 | ||
30 | function setup_live_tracing() | |
31 | { | |
32 | # Create session with default path | |
33 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \ | |
34 | -U net://localhost >/dev/null 2>&1 | |
35 | ||
36 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -u >/dev/null 2>&1 | |
37 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $SESSION_NAME >/dev/null 2>&1 | |
38 | } | |
39 | ||
40 | function clean_live_tracing() | |
41 | { | |
42 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $SESSION_NAME >/dev/null 2>&1 | |
43 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $SESSION_NAME >/dev/null 2>&1 | |
44 | rm -rf $TRACE_PATH | |
45 | } | |
46 | ||
33e55711 | 47 | file_sync_after_first=$(mktemp --tmpdir -u tmp.test_live_ust_sync_after_first.XXXXXX) |
05aa48da MD |
48 | |
49 | start_lttng_sessiond_notap | |
50 | start_lttng_relayd_notap "-o $TRACE_PATH" | |
1b368955 JD |
51 | |
52 | setup_live_tracing | |
53 | ||
6c4a91d6 | 54 | $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1 |
05aa48da MD |
55 | |
56 | while [ ! -f "${file_sync_after_first}" ]; do | |
57 | sleep 0.5 | |
58 | done | |
1b368955 JD |
59 | |
60 | # Start the live test | |
61 | $TESTDIR/regression/tools/live/live_test | |
62 | ||
63 | clean_live_tracing | |
64 | ||
05aa48da MD |
65 | rm -f ${file_sync_after_first} |
66 | ||
05aa48da | 67 | stop_lttng_sessiond_notap |
165b4553 | 68 | stop_lttng_relayd_notap |