09d0d8fc7acbc8f0f68afb8a0e7b37d1a5b748b1
[lttng-tools.git] / tests / regression / tools / regen-statedump / test_ust
1 #!/bin/bash
2 #
3 # Copyright (C) 2016 Julien Desfossez <jdesfossez@efficios.com>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only
6
7 TEST_DESC="Regenerate the statedump - User-space tracing"
8
9 CURDIR=$(dirname $0)/
10 TESTDIR=$CURDIR/../../..
11 NR_ITER=10
12 NR_USEC_WAIT=0
13 TESTAPP_PATH="$TESTDIR/utils/testapp"
14 TESTAPP_NAME="gen-ust-events"
15 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
16 SESSION_NAME="stream"
17 EVENT_NAME="lttng_ust_statedump:start,lttng_ust_statedump:end"
18
19 TRACE_PATH=$(mktemp -d)
20
21 NUM_TESTS=11
22
23 source $TESTDIR/utils/utils.sh
24
25 if [ ! -x "$TESTAPP_BIN" ]; then
26 BAIL_OUT "No UST events binary detected."
27 fi
28
29 function test_ust_local ()
30 {
31 local file_sync_after_first=$(mktemp -u)
32 local file_sync_before_last=$(mktemp -u)
33
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
37
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 &
41
42 start_lttng_tracing_ok $SESSION_NAME
43
44 while [ ! -f "${file_sync_after_first}" ]; do
45 sleep 0.5
46 done
47
48 regenerate_statedump_ok $SESSION_NAME
49
50 touch ${file_sync_before_last}
51
52 stop_lttng_tracing_ok $SESSION_NAME
53 destroy_lttng_session_ok $SESSION_NAME
54 # Validate test
55 validate_trace_count $EVENT_NAME $TRACE_PATH 4
56 if [ $? -eq 0 ]; then
57 # Only delete if successful
58 rm -rf $TRACE_PATH
59 fi
60 rm -f ${file_sync_after_first}
61 rm -f ${file_sync_before_last}
62 }
63
64 plan_tests $NUM_TESTS
65
66 print_test_banner "$TEST_DESC"
67
68 start_lttng_sessiond
69
70 tests=( test_ust_local )
71
72 for fct_test in ${tests[@]};
73 do
74 SESSION_NAME=$(randstring 16 0)
75 ${fct_test}
76 done
77
78 stop_lttng_sessiond
79
80 exit $out
This page took 0.0305 seconds and 4 git commands to generate.