Commit | Line | Data |
---|---|---|
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 | |
7 | CURDIR=$(dirname $0)/ | |
8 | TESTDIR=$CURDIR/../../../ | |
9 | ||
345ed219 JR |
10 | TMPDIR=$(mktemp -d) |
11 | ||
434f8068 | 12 | #This is needed since the testpoint create a pipe with the consumerd type suffixed |
345ed219 | 13 | TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n") |
434f8068 | 14 | TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX") |
434f8068 JR |
15 | TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so) |
16 | ||
854382b8 | 17 | |
434f8068 | 18 | TESTAPP_PATH="$TESTDIR/utils/testapp" |
d3a684ee JR |
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 | ||
345ed219 | 26 | TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") |
434f8068 | 27 | |
d3a684ee | 28 | NR_ITER=5 |
434f8068 JR |
29 | NR_USEC_WAIT=5 |
30 | ||
31 | SESSION_NAME="my_session" | |
854382b8 | 32 | CHANNEL_NAME="my_channel" |
434f8068 JR |
33 | |
34 | TRACE_PATH=$(mktemp -d) | |
63f1709b | 35 | PAGE_SIZE=$(getconf PAGE_SIZE) |
434f8068 JR |
36 | |
37 | DIR=$(readlink -f $TESTDIR) | |
38 | ||
854382b8 | 39 | |
434f8068 JR |
40 | source $TESTDIR/utils/utils.sh |
41 | ||
cb723729 | 42 | function ust_event_generator_toggle_state |
854382b8 JR |
43 | { |
44 | ust_event_generator_suspended=$((ust_event_generator_suspended==0)) | |
45 | ||
46 | } | |
47 | function ust_event_generator | |
48 | { | |
d3a684ee JR |
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 |
d3a684ee | 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 | |
d3a684ee JR |
67 | function test_event_rule_condition_exclusion_notification |
68 | { | |
69 | ust_event_generator $GEN_UST_NEVENTS_TESTAPP_BIN $TESTAPP_STATE_PATH & | |
70 | APP_PID=$! | |
434f8068 | 71 | |
d3a684ee | 72 | $CURDIR/.libs/notification 3 LTTNG_DOMAIN_UST $APP_PID $TESTAPP_STATE_PATH |
434f8068 | 73 | |
d3a684ee JR |
74 | kill -9 $APP_PID |
75 | wait $APP_PID 2> /dev/null | |
76 | } | |
434f8068 | 77 | |
d3a684ee JR |
78 | LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}" |
79 | start_lttng_sessiond_notap | |
434f8068 | 80 | |
d3a684ee | 81 | test_event_rule_condition_exclusion_notification |
434f8068 JR |
82 | |
83 | stop_lttng_sessiond_notap | |
84 | ||
345ed219 | 85 | rm -rf $TMPDIR |