3 # Copyright (C) - 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
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.
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
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
19 TESTDIR
=$CURDIR/..
/..
/..
/
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
)
27 TESTAPP_PATH
="$TESTDIR/utils/testapp"
28 TESTAPP_NAME
="gen-ust-events"
29 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
34 SESSION_NAME
="my_session"
35 CHANNEL_NAME
="my_ust_channel"
36 EVENT_NAME
="tp:tptest"
38 TRACE_PATH
=$
(mktemp
-d)
39 PAGE_SIZE
=$
(getconf PAGE_SIZE
)
41 DIR
=$
(readlink
-f $TESTDIR)
43 source $TESTDIR/utils
/utils.sh
47 file_sync_after_first_event
=$
(mktemp
-u)
49 LTTNG_SESSIOND_ENV_VARS
="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
50 start_lttng_sessiond_notap
52 create_lttng_session_notap
$SESSION_NAME $TRACE_PATH
54 enable_ust_lttng_channel_notap
$SESSION_NAME $CHANNEL_NAME --subbuf-size=$PAGE_SIZE
55 enable_ust_lttng_event_notap
$SESSION_NAME $EVENT_NAME $CHANNEL_NAME
57 #This is needed since the testpoint create a pipe with the consumer type suffixed
58 for f
in "$TESTPOINT_BASE_PATH"*; do
59 consumerd_pipe
+=("$f")
63 # Start app in infinite loop
64 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $file_sync_after_first_event &
66 # Pin to CPU zero to force specific sub buffer usage
67 taskset
-p -c 0 $APP_PID > /dev
/null
2>&1
69 while [ ! -f "${file_sync_after_first_event}" ]; do
72 rm ${file_sync_after_first_event}
74 # The actual test suite
75 # TODO: Add support for kernel domain
76 $CURDIR/notification
$SESSION_NAME $CHANNEL_NAME LTTNG_DOMAIN_UST
${consumerd_pipe[@]}
78 stop_lttng_sessiond_notap
80 # On ungraceful kill the app is cleaned up via the full_cleanup call
81 # Suppress kill message
83 wait $APP_PID 2> /dev
/null
85 # Just in case cleanup
87 rm ${consumerd_pipe[@]} 2> /dev
/null