Tests: regression testing for notification API
[lttng-tools.git] / tests / regression / tools / notification / test_notification
1 #!/bin/bash
2 #
3 # Copyright (C) - 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@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 #This is needed since the testpoint create a pipe with the consumerd type suffixed
22 TESTPOINT_BASE_PATH=$(readlink -f "$CURDIR/lttng.t_p_n")
23 TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
24 TESTPOIT_ARGS="CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LTTNG_TESTPOINT_ENABLE=1"
25 TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so)
26
27 TESTAPP_PATH="$TESTDIR/utils/testapp"
28 TESTAPP_NAME="gen-ust-events"
29 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
30
31 NR_ITER=-1
32 NR_USEC_WAIT=5
33
34 SESSION_NAME="my_session"
35 CHANNEL_NAME="my_ust_channel"
36 EVENT_NAME="tp:tptest"
37
38 TRACE_PATH=$(mktemp -d)
39
40 DIR=$(readlink -f $TESTDIR)
41
42 source $TESTDIR/utils/utils.sh
43
44 consumerd_pipe=()
45
46 file_sync_after_first_event=$(mktemp -u)
47
48 LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
49 start_lttng_sessiond_notap
50
51 create_lttng_session_notap $SESSION_NAME $TRACE_PATH
52
53 enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=4096
54 enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
55
56 #This is needed since the testpoint create a pipe with the consumer type suffixed
57 for f in "$TESTPOINT_BASE_PATH"*; do
58 consumerd_pipe+=("$f")
59 done
60
61
62 # Start app in infinite loop
63 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $file_sync_after_first_event &
64 APP_PID=$!
65 # Pin to CPU zero to force specific sub buffer usage
66 taskset -p -c 0 $APP_PID > /dev/null 2>&1
67
68 while [ ! -f "${file_sync_after_first_event}" ]; do
69 sleep 0.5
70 done
71 rm ${file_sync_after_first_event}
72
73 # The actual test suite
74 # TODO: Add support for kernel domain
75 $CURDIR/notification $SESSION_NAME $CHANNEL_NAME LTTNG_DOMAIN_UST ${consumerd_pipe[@]}
76
77 stop_lttng_sessiond_notap
78
79 # On ungraceful kill the app is cleaned up via the full_cleanup call
80 # Suppress kill message
81 kill -9 $APP_PID
82 wait $APP_PID 2> /dev/null
83
84 # Just in case cleanup
85 rm -rf $TRACE_PATH
86 rm ${consumerd_pipe[@]} 2> /dev/null
This page took 0.030482 seconds and 4 git commands to generate.