3 # Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
5 # SPDX-License-Identifier: GPL-2.0-only
8 TEST_DESC
="Kernel tracer - function event"
14 source $TESTDIR/utils
/utils.sh
16 function test_kernel_function_basic
()
18 local TRACE_PATH
=$
(mktemp
--tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
19 local SESSION_NAME
="kernel_function_basic"
20 local EVENT_NAME
="my_event_name"
21 local TARGET_SYMBOL
="lttng_test_filter_event_write"
23 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
25 lttng_enable_kernel_function_event_ok
$SESSION_NAME "$TARGET_SYMBOL" "$EVENT_NAME"
27 start_lttng_tracing_ok
29 echo 1 > /proc
/lttng-test-filter-event
33 validate_trace
"${EVENT_NAME}_entry" $TRACE_PATH
34 validate_trace
"${EVENT_NAME}_exit" $TRACE_PATH
36 destroy_lttng_session_ok
$SESSION_NAME
41 # MUST set TESTDIR before calling those functions
44 print_test_banner
"$TEST_DESC"
46 if [ "$(id -u)" == "0" ]; then
52 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
54 start_lttng_sessiond_notap
55 validate_lttng_modules_present
58 test_kernel_function_basic
60 modprobe
--remove lttng-test
61 stop_lttng_sessiond_notap