tests: Add diagnostic info for kernel bug, warning, and oops
[lttng-tools.git] / tests / regression / kernel / test_kernel_function
CommitLineData
b6d14cf3
FD
1#!/bin/bash
2#
3# Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7
8TEST_DESC="Kernel tracer - function event"
9
10CURDIR=$(dirname $0)/
11TESTDIR=$CURDIR/../..
f84dea81 12NUM_TESTS=7
b6d14cf3
FD
13
14source $TESTDIR/utils/utils.sh
15
16function test_kernel_function_basic()
17{
8d5a3312 18 local TRACE_PATH=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
b6d14cf3
FD
19 local SESSION_NAME="kernel_function_basic"
20 local EVENT_NAME="my_event_name"
21 local TARGET_SYMBOL="lttng_test_filter_event_write"
22
23 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
24
25 lttng_enable_kernel_function_event_ok $SESSION_NAME "$TARGET_SYMBOL" "$EVENT_NAME"
26
27 start_lttng_tracing_ok
28
29 echo 1 > /proc/lttng-test-filter-event
30
31 stop_lttng_tracing_ok
32
33 validate_trace "${EVENT_NAME}_entry" $TRACE_PATH
c2e77b42 34 validate_trace "${EVENT_NAME}_exit" $TRACE_PATH
b6d14cf3
FD
35
36 destroy_lttng_session_ok $SESSION_NAME
37
38 rm -rf $TRACE_PATH
39}
40
41# MUST set TESTDIR before calling those functions
42plan_tests $NUM_TESTS
43
44print_test_banner "$TEST_DESC"
45
3a174400 46check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
b6d14cf3
FD
47{
48 start_lttng_sessiond_notap
49 validate_lttng_modules_present
50 modprobe lttng-test
51
52 test_kernel_function_basic
53
54 modprobe --remove lttng-test
55 stop_lttng_sessiond_notap
56}
This page took 0.042231 seconds and 4 git commands to generate.