SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / tests / regression / tools / notification / test_notification_ust_event_rule_condition_exclusion
1 #!/bin/bash
2 #
3 # Copyright (C) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only
6
7 CURDIR=$(dirname $0)/
8 TESTDIR=$CURDIR/../../../
9
10 TMPDIR=$(mktemp -d)
11
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)
16
17
18 TESTAPP_PATH="$TESTDIR/utils/testapp"
19
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"
22
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"
25
26 TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
27
28 NR_ITER=5
29 NR_USEC_WAIT=5
30
31 SESSION_NAME="my_session"
32 CHANNEL_NAME="my_channel"
33
34 TRACE_PATH=$(mktemp -d)
35 PAGE_SIZE=$(getconf PAGE_SIZE)
36
37 DIR=$(readlink -f $TESTDIR)
38
39
40 source $TESTDIR/utils/utils.sh
41
42 function ust_event_generator_toggle_state
43 {
44 ust_event_generator_suspended=$((ust_event_generator_suspended==0))
45
46 }
47 function ust_event_generator
48 {
49 test_app=$1
50 state_file=$2
51 ust_event_generator_suspended=0
52 trap ust_event_generator_toggle_state SIGUSR1
53
54 while (true); do
55 if [[ $ust_event_generator_suspended -eq "1" ]]; then
56 touch $state_file
57 sleep 0.5
58 else
59 if [[ -f $state_file ]]; then
60 rm -rf $state_file 2> /dev/null
61 fi
62 taskset -c 0 $test_app -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
63 fi
64 done
65 }
66
67 function test_event_rule_condition_exclusion_notification
68 {
69 ust_event_generator $GEN_UST_NEVENTS_TESTAPP_BIN $TESTAPP_STATE_PATH &
70 APP_PID=$!
71
72 $CURDIR/.libs/notification 3 LTTNG_DOMAIN_UST $APP_PID $TESTAPP_STATE_PATH
73
74 kill -9 $APP_PID
75 wait $APP_PID 2> /dev/null
76 }
77
78 LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
79 start_lttng_sessiond_notap
80
81 test_event_rule_condition_exclusion_notification
82
83 stop_lttng_sessiond_notap
84
85 rm -rf $TMPDIR
This page took 0.045895 seconds and 5 git commands to generate.