| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# SPDX-FileCopyrightText: 2017 Jonathan Rajotte-Julien <[email protected]> |
| 4 |
# |
| 5 |
# SPDX-License-Identifier: LGPL-2.1-only |
| 6 |
|
| 7 |
CURDIR=$(dirname "$0")/ |
| 8 |
TESTDIR=$CURDIR/../../../ |
| 9 |
|
| 10 |
|
| 11 |
TESTAPP_PATH="$TESTDIR/utils/testapp" |
| 12 |
|
| 13 |
GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events" |
| 14 |
GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME" |
| 15 |
|
| 16 |
TESTAPP_STATE_PATH=$(mktemp -u -t "tmp.test_notif_ust_error_application_state.XXXXXX") |
| 17 |
|
| 18 |
# shellcheck source=../../../utils/utils.sh |
| 19 |
source "$TESTDIR/utils/utils.sh" |
| 20 |
EVENT_GENERATOR_SCRIPT="${CURDIR}/util_event_generator.py" |
| 21 |
|
| 22 |
function test_basic_error_path |
| 23 |
{ |
| 24 |
READY_FILE="$(mktemp -u -t "generator_ready.XXXXXX")" |
| 25 |
USERSPACE_TESTAPP_BIN="${GEN_UST_EVENTS_TESTAPP_BIN}" "${EVENT_GENERATOR_SCRIPT}" \ |
| 26 |
--ready-file "${READY_FILE}" --state-file "${TESTAPP_STATE_PATH}" \ |
| 27 |
--iterations 5 --wait 5 --run-once \ |
| 28 |
userspace_testapp & |
| 29 |
APP_PID=$! |
| 30 |
while [ ! -f "${READY_FILE}" ]; do |
| 31 |
sleep 0.1 |
| 32 |
done |
| 33 |
rm -f "${READY_FILE}" |
| 34 |
|
| 35 |
"$CURDIR/notification" 1 LTTNG_DOMAIN_UST $APP_PID "$TESTAPP_STATE_PATH" |
| 36 |
|
| 37 |
kill -SIGUSR2 $APP_PID |
| 38 |
wait $APP_PID 2> /dev/null |
| 39 |
} |
| 40 |
|
| 41 |
# Avoid spurious tap messages from the shell runner |
| 42 |
tap_disable |
| 43 |
|
| 44 |
start_lttng_sessiond_notap |
| 45 |
|
| 46 |
test_basic_error_path |
| 47 |
|
| 48 |
stop_lttng_sessiond_notap |
| 49 |
|
| 50 |
rm -f $TESTAPP_STATE_PATH |