Commit | Line | Data |
---|---|---|
88a5c0a9 JG |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
88a5c0a9 | 4 | # |
9d16b343 | 5 | # SPDX-License-Identifier: LGPL-2.1-only |
88a5c0a9 JG |
6 | |
7 | CURDIR=$(dirname $0)/ | |
8 | TESTDIR=$CURDIR/../../../ | |
9 | ||
10 | TESTAPP_PATH="$TESTDIR/utils/testapp" | |
11 | TESTAPP_NAME="gen-ust-events" | |
12 | TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" | |
13 | ||
14 | SESSION_NAME="my_session" | |
15 | TMP_DIR=$(mktemp -d) | |
16 | SESSION_OUTPUT_PATH=$TMP_DIR/output | |
17 | EVENT_NAME="tp:tptest" | |
18 | ||
19 | PAGE_SIZE=$(getconf PAGE_SIZE) | |
20 | SUBBUF_SIZE=$(expr $PAGE_SIZE \* 8) | |
21 | ||
22 | FILE_SYNC_AFTER_FIRST_EVENT=$(mktemp -u) | |
23 | ||
24 | NR_ITER=-1 | |
25 | NR_USEC_WAIT=5 | |
26 | ||
27 | DIR=$(readlink -f $TESTDIR) | |
28 | ||
29 | source $TESTDIR/utils/utils.sh | |
30 | start_lttng_sessiond_notap | |
31 | ||
32 | create_lttng_session_notap $SESSION_NAME $SESSION_OUTPUT_PATH | |
33 | ||
34 | enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=$SUBBUF_SIZE | |
35 | enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME | |
36 | ||
37 | start_lttng_tracing_notap $SESSION_NAME | |
38 | ||
6c4a91d6 | 39 | $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $FILE_SYNC_AFTER_FIRST_EVENT & |
88a5c0a9 JG |
40 | APP_PID=$! |
41 | while [ ! -f "${FILE_SYNC_AFTER_FIRST_EVENT}" ]; do | |
42 | sleep 0.5 | |
43 | done | |
44 | ||
45 | # The rotation application handles the actual testing once the tracing session | |
46 | # has been setup. | |
47 | $CURDIR/rotation $SESSION_NAME $SESSION_OUTPUT_PATH | |
48 | if [ $? -ne 0 ]; then | |
49 | diag "Failed to run rotation notification client" | |
50 | fi | |
51 | ||
52 | stop_lttng_tracing_notap $SESSION_NAME | |
53 | ||
54 | stop_lttng_sessiond_notap | |
55 | ||
56 | # On ungraceful kill the app is cleaned up via the full_cleanup call | |
57 | # Suppress kill message | |
58 | kill -9 $APP_PID | |
59 | wait $APP_PID 2> /dev/null | |
60 | ||
61 | rm -rf $TMP_DIR | |
62 | rm $FILE_SYNC_AFTER_FIRST_EVENT 2> /dev/null |