3 # Copyright (C) 2016 Julien Desfossez <jdesfossez@efficios.com>
5 # SPDX-License-Identifier: LGPL-2.1-only
7 TEST_DESC
="Regenerate the statedump - User-space tracing"
10 TESTDIR
=$CURDIR/..
/..
/..
13 TESTAPP_PATH
="$TESTDIR/utils/testapp"
14 TESTAPP_NAME
="gen-ust-events"
15 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
17 EVENT_NAME
="lttng_ust_statedump:start,lttng_ust_statedump:end"
19 TRACE_PATH
=$
(mktemp
-d -t tmp.test_regenerate_statedump_ust_trace_path.XXXXXX
)
23 source $TESTDIR/utils
/utils.sh
25 if [ ! -x "$TESTAPP_BIN" ]; then
26 BAIL_OUT
"No UST events binary detected."
29 function test_ust_local
()
31 local file_sync_after_first
=$
(mktemp
-u -t tmp.test_
${FUNCNAME[0]}_sync_after_first.XXXXXX
)
32 local file_sync_before_last
=$
(mktemp
-u -t tmp.test_
${FUNCNAME[0]}_sync_before_last.XXXXXX
)
34 diag
"Test UST local with statedump regeneration"
35 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
36 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME
38 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
39 --sync-after-first-event ${file_sync_after_first} \
40 --sync-before-last-event ${file_sync_before_last} >/dev
/null
2>&1 &
42 start_lttng_tracing_ok
$SESSION_NAME
44 while [ ! -f "${file_sync_after_first}" ]; do
48 regenerate_statedump_ok
$SESSION_NAME
50 touch ${file_sync_before_last}
52 stop_lttng_tracing_ok
$SESSION_NAME
53 destroy_lttng_session_ok
$SESSION_NAME
55 validate_trace_count
$EVENT_NAME $TRACE_PATH 4
57 # Only delete if successful
60 rm -f ${file_sync_after_first}
61 rm -f ${file_sync_before_last}
66 print_test_banner
"$TEST_DESC"
67 bail_out_if_no_babeltrace
71 tests
=( test_ust_local
)
73 for fct_test
in ${tests[@]};
75 SESSION_NAME
=$
(randstring
16 0)