3 # Copyright (C) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
5 # SPDX-License-Identifier: LGPL-2.1-only
8 TESTDIR
=$CURDIR/..
/..
/..
/
12 #This is needed since the testpoint create a pipe with the consumerd type suffixed
13 TESTPOINT_BASE_PATH
=$
(readlink
-f "$TMPDIR/lttng.t_p_n")
14 TESTPOINT_PIPE_PATH
=$
(mktemp
-u "${TESTPOINT_BASE_PATH}.XXXXXX")
15 TESTPOINT
=$
(readlink
-f ${CURDIR}/.libs
/libpause_consumer.so
)
18 TESTAPP_PATH
="$TESTDIR/utils/testapp"
20 GEN_UST_EVENTS_TESTAPP_NAME
="gen-ust-events"
21 GEN_UST_EVENTS_TESTAPP_BIN
="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
23 GEN_UST_NEVENTS_TESTAPP_NAME
="gen-ust-nevents"
24 GEN_UST_NEVENTS_TESTAPP_BIN
="$TESTAPP_PATH/$GEN_UST_NEVENTS_TESTAPP_NAME/$GEN_UST_NEVENTS_TESTAPP_NAME"
26 TESTAPP_STATE_PATH
=$
(mktemp
-u "$TMPDIR/application_state.XXXXXXXXXX")
31 SESSION_NAME
="my_session"
32 CHANNEL_NAME
="my_channel"
34 TRACE_PATH
=$
(mktemp
-d)
35 PAGE_SIZE
=$
(getconf PAGE_SIZE
)
37 DIR
=$
(readlink
-f $TESTDIR)
40 source $TESTDIR/utils
/utils.sh
42 function ust_event_generator_toggle_state
44 ust_event_generator_suspended
=$
((ust_event_generator_suspended
==0))
47 function ust_event_generator
51 ust_event_generator_suspended
=0
52 trap ust_event_generator_toggle_state SIGUSR1
55 if [[ $ust_event_generator_suspended -eq "1" ]]; then
59 if [[ -f $state_file ]]; then
60 rm -rf $state_file 2> /dev
/null
62 taskset
-c 0 $test_app -i $NR_ITER -w $NR_USEC_WAIT > /dev
/null
2>&1
67 function test_buffer_usage_notification
70 file_sync_after_first_event
=$
(mktemp
-u)
71 event_name
="tp:tptest"
73 create_lttng_session_notap
$SESSION_NAME $TRACE_PATH
75 enable_ust_lttng_channel_notap
$SESSION_NAME $CHANNEL_NAME --subbuf-size=$PAGE_SIZE
76 enable_ust_lttng_event_notap
$SESSION_NAME $event_name $CHANNEL_NAME
78 #This is needed since the testpoint create a pipe with the consumer type suffixed
79 for f
in "$TESTPOINT_BASE_PATH"*; do
80 consumerd_pipe
+=("$f")
83 ust_event_generator
$GEN_UST_EVENTS_TESTAPP_BIN $TESTAPP_STATE_PATH &
86 $CURDIR/notification
2 LTTNG_DOMAIN_UST
$APP_PID $TESTAPP_STATE_PATH $SESSION_NAME $CHANNEL_NAME ${consumerd_pipe[@]}
88 destroy_lttng_session_notap
$SESSION_NAME
90 # On ungraceful kill the app is cleaned up via the full_cleanup call
91 # Suppress kill message
93 wait $APP_PID 2> /dev
/null
95 # Just in case cleanup
99 LTTNG_SESSIOND_ENV_VARS
="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
100 start_lttng_sessiond_notap
102 test_buffer_usage_notification
104 stop_lttng_sessiond_notap