Tests: triggers: Add userspace-probe event rule condition kernel tests
[lttng-tools.git] / tests / regression / tools / notification / test_notification_kernel_userspace_probe
CommitLineData
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
7CURDIR=$(dirname "$0")/
8TESTDIR=$CURDIR/../../../
9
10TMPDIR=$(mktemp -d)
11
12TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
13
14NUM_TESTS=13
15
16# shellcheck source=../../../utils/utils.sh
17source "$TESTDIR/utils/utils.sh"
18# shellcheck source=./util_event_generator.sh
19source "$CURDIR/util_event_generator.sh"
20
21function 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
34if [ "$(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
42else
43 # Kernel tests are skipped.
44 plan_tests $NUM_TESTS
45 skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
46fi
47
48# Just in case cleanup
49rm -rf "$TMPDIR"
This page took 0.025808 seconds and 4 git commands to generate.