Commit | Line | Data |
---|---|---|
54cd6107 JD |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2016 Julien Desfossez <jdesfossez@efficios.com> |
54cd6107 | 4 | # |
9d16b343 MJ |
5 | # SPDX-License-Identifier: LGPL-2.1-only |
6 | ||
54cd6107 JD |
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" | |
54cd6107 | 18 | |
33e55711 | 19 | TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regenerate_statedump_ust_trace_path.XXXXXX) |
54cd6107 JD |
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 | { | |
33e55711 FD |
31 | local file_sync_after_first=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_sync_after_first.XXXXXX) |
32 | local file_sync_before_last=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_sync_before_last.XXXXXX) | |
54cd6107 JD |
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 | ||
6c4a91d6 MD |
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 & | |
54cd6107 JD |
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 |