Tests: rotation: add a per-pid size-based rotation test
[lttng-tools.git] / tests / regression / tools / notification / test_rotation
1 #!/bin/bash
2 #
3 # Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only
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 SESSION_OUTPUT_PATH=$(mktemp --tmpdir -d tmp.test_notif_rotation_trace_path.XXXXXX)
16 EVENT_NAME="tp:tptest"
17
18 PAGE_SIZE=$(getconf PAGE_SIZE)
19 SUBBUF_SIZE=$(expr $PAGE_SIZE \* 8)
20
21 FILE_SYNC_AFTER_FIRST_EVENT=$(mktemp --tmpdir -u tmp.test_rotation_sync_after_first.XXXXXX)
22
23 NR_ITER=-1
24 NR_USEC_WAIT=5
25
26 DIR=$(readlink -f $TESTDIR)
27
28 source $TESTDIR/utils/utils.sh
29 start_lttng_sessiond_notap
30
31 create_lttng_session_notap $SESSION_NAME $SESSION_OUTPUT_PATH
32
33 enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=$SUBBUF_SIZE
34 enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
35
36 start_lttng_tracing_notap $SESSION_NAME
37
38 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $FILE_SYNC_AFTER_FIRST_EVENT &
39 APP_PID=$!
40 while [ ! -f "${FILE_SYNC_AFTER_FIRST_EVENT}" ]; do
41 sleep 0.5
42 done
43
44 # The rotation application handles the actual testing once the tracing session
45 # has been setup.
46 $CURDIR/rotation $SESSION_NAME $SESSION_OUTPUT_PATH
47 if [ $? -ne 0 ]; then
48 diag "Failed to run rotation notification client"
49 fi
50
51 stop_lttng_tracing_notap $SESSION_NAME
52
53 stop_lttng_sessiond_notap
54
55 # On ungraceful kill the app is cleaned up via the full_cleanup call
56 # Suppress kill message
57 kill -9 $APP_PID
58 wait $APP_PID 2> /dev/null
59
60 rm -rf $SESSION_OUTPUT_PATH
61 rm -f $FILE_SYNC_AFTER_FIRST_EVENT
This page took 0.03247 seconds and 4 git commands to generate.