Rename lttng_event_rule_kernel_probe to lttng_event_rule_kernel_kprobe
[lttng-tools.git] / tests / regression / tools / regen-statedump / test_ust
CommitLineData
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
7TEST_DESC="Regenerate the statedump - User-space tracing"
8
9CURDIR=$(dirname $0)/
10TESTDIR=$CURDIR/../../..
11NR_ITER=10
12NR_USEC_WAIT=0
13TESTAPP_PATH="$TESTDIR/utils/testapp"
14TESTAPP_NAME="gen-ust-events"
15TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
16SESSION_NAME="stream"
17EVENT_NAME="lttng_ust_statedump:start,lttng_ust_statedump:end"
54cd6107 18
33e55711 19TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regenerate_statedump_ust_trace_path.XXXXXX)
54cd6107
JD
20
21NUM_TESTS=11
22
23source $TESTDIR/utils/utils.sh
24
25if [ ! -x "$TESTAPP_BIN" ]; then
26 BAIL_OUT "No UST events binary detected."
27fi
28
29function 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
64plan_tests $NUM_TESTS
65
66print_test_banner "$TEST_DESC"
67
68start_lttng_sessiond
69
70tests=( test_ust_local )
71
72for fct_test in ${tests[@]};
73do
74 SESSION_NAME=$(randstring 16 0)
75 ${fct_test}
76done
77
78stop_lttng_sessiond
79
80exit $out
This page took 0.035892 seconds and 4 git commands to generate.