tests: gen-ust-events: use options instead of arguments
[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 # This library is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this library; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18 CURDIR=$(dirname $0)/
19 TESTDIR=$CURDIR/../../../
20
21 TESTAPP_PATH="$TESTDIR/utils/testapp"
22 TESTAPP_NAME="gen-ust-events"
23 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
24
25 SESSION_NAME="my_session"
26 TMP_DIR=$(mktemp -d)
27 SESSION_OUTPUT_PATH=$TMP_DIR/output
28 EVENT_NAME="tp:tptest"
29
30 PAGE_SIZE=$(getconf PAGE_SIZE)
31 SUBBUF_SIZE=$(expr $PAGE_SIZE \* 8)
32
33 FILE_SYNC_AFTER_FIRST_EVENT=$(mktemp -u)
34
35 NR_ITER=-1
36 NR_USEC_WAIT=5
37
38 DIR=$(readlink -f $TESTDIR)
39
40 source $TESTDIR/utils/utils.sh
41 start_lttng_sessiond_notap
42
43 create_lttng_session_notap $SESSION_NAME $SESSION_OUTPUT_PATH
44
45 enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=$SUBBUF_SIZE
46 enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
47
48 start_lttng_tracing_notap $SESSION_NAME
49
50 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $FILE_SYNC_AFTER_FIRST_EVENT &
51 APP_PID=$!
52 while [ ! -f "${FILE_SYNC_AFTER_FIRST_EVENT}" ]; do
53 sleep 0.5
54 done
55
56 # The rotation application handles the actual testing once the tracing session
57 # has been setup.
58 $CURDIR/rotation $SESSION_NAME $SESSION_OUTPUT_PATH
59 if [ $? -ne 0 ]; then
60 diag "Failed to run rotation notification client"
61 fi
62
63 stop_lttng_tracing_notap $SESSION_NAME
64
65 stop_lttng_sessiond_notap
66
67 # On ungraceful kill the app is cleaned up via the full_cleanup call
68 # Suppress kill message
69 kill -9 $APP_PID
70 wait $APP_PID 2> /dev/null
71
72 rm -rf $TMP_DIR
73 rm $FILE_SYNC_AFTER_FIRST_EVENT 2> /dev/null
This page took 0.035228 seconds and 5 git commands to generate.