Commit | Line | Data |
---|---|---|
45294d8a FD |
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 | TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") | |
13 | ||
14 | NUM_TESTS=13 | |
15 | ||
16 | # shellcheck source=../../../utils/utils.sh | |
17 | source "$TESTDIR/utils/utils.sh" | |
18 | # shellcheck source=./util_event_generator.sh | |
19 | source "$CURDIR/util_event_generator.sh" | |
20 | ||
21 | function test_kernel_userspace_probe_notification | |
22 | { | |
23 | kernel_event_generator_run_once_per_transition userspace_probe_testapp "$TESTAPP_STATE_PATH" 10 & | |
24 | APP_PID=$! | |
25 | ||
26 | "$CURDIR/notification" 6 LTTNG_DOMAIN_KERNEL \ | |
27 | $APP_PID "$TESTAPP_STATE_PATH" \ | |
28 | "$USERSPACE_PROBE_ELF_TESTAPP_BIN" "test_function" | |
29 | ||
30 | kill -SIGUSR2 $APP_PID | |
31 | wait $APP_PID 2> /dev/null | |
32 | } | |
33 | ||
34 | if [ "$(id -u)" == "0" ]; then | |
35 | validate_lttng_modules_present | |
36 | ||
37 | start_lttng_sessiond_notap | |
38 | ||
39 | test_kernel_userspace_probe_notification | |
40 | ||
41 | stop_lttng_sessiond_notap | |
42 | else | |
43 | # Kernel tests are skipped. | |
44 | plan_tests $NUM_TESTS | |
45 | skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS | |
46 | fi | |
47 | ||
48 | # Just in case cleanup | |
49 | rm -rf "$TMPDIR" |