SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / tests / regression / tools / notification / test_notification_ust_event_rule_condition_exclusion
CommitLineData
434f8068
JR
1#!/bin/bash
2#
9d16b343 3# Copyright (C) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
434f8068 4#
9d16b343 5# SPDX-License-Identifier: LGPL-2.1-only
434f8068
JR
6
7CURDIR=$(dirname $0)/
8TESTDIR=$CURDIR/../../../
9
345ed219
JR
10TMPDIR=$(mktemp -d)
11
434f8068 12#This is needed since the testpoint create a pipe with the consumerd type suffixed
345ed219 13TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
434f8068 14TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
434f8068
JR
15TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so)
16
854382b8 17
434f8068 18TESTAPP_PATH="$TESTDIR/utils/testapp"
1831ae68
FD
19
20GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events"
21GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
22
23GEN_UST_NEVENTS_TESTAPP_NAME="gen-ust-nevents"
24GEN_UST_NEVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_NEVENTS_TESTAPP_NAME/$GEN_UST_NEVENTS_TESTAPP_NAME"
25
345ed219 26TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
434f8068 27
1831ae68 28NR_ITER=5
434f8068
JR
29NR_USEC_WAIT=5
30
31SESSION_NAME="my_session"
854382b8 32CHANNEL_NAME="my_channel"
434f8068
JR
33
34TRACE_PATH=$(mktemp -d)
63f1709b 35PAGE_SIZE=$(getconf PAGE_SIZE)
434f8068
JR
36
37DIR=$(readlink -f $TESTDIR)
38
854382b8 39
434f8068
JR
40source $TESTDIR/utils/utils.sh
41
cb723729 42function ust_event_generator_toggle_state
854382b8
JR
43{
44 ust_event_generator_suspended=$((ust_event_generator_suspended==0))
45
46}
47function ust_event_generator
48{
1831ae68
FD
49 test_app=$1
50 state_file=$2
854382b8 51 ust_event_generator_suspended=0
cb723729 52 trap ust_event_generator_toggle_state SIGUSR1
3be453c9 53
854382b8
JR
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
345ed219 60 rm -rf $state_file 2> /dev/null
854382b8 61 fi
1831ae68 62 taskset -c 0 $test_app -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
854382b8
JR
63 fi
64 done
65}
434f8068 66
1831ae68
FD
67function test_event_rule_condition_exclusion_notification
68{
69 ust_event_generator $GEN_UST_NEVENTS_TESTAPP_BIN $TESTAPP_STATE_PATH &
70 APP_PID=$!
434f8068 71
1831ae68 72 $CURDIR/.libs/notification 3 LTTNG_DOMAIN_UST $APP_PID $TESTAPP_STATE_PATH
434f8068 73
1831ae68
FD
74 kill -9 $APP_PID
75 wait $APP_PID 2> /dev/null
76}
434f8068 77
1831ae68
FD
78LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
79start_lttng_sessiond_notap
434f8068 80
1831ae68 81test_event_rule_condition_exclusion_notification
434f8068
JR
82
83stop_lttng_sessiond_notap
84
345ed219 85rm -rf $TMPDIR
This page took 0.042331 seconds and 5 git commands to generate.