Commit | Line | Data |
---|---|---|
a3ed20b4 CB |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com> |
a3ed20b4 | 4 | # |
9d16b343 | 5 | # SPDX-License-Identifier: GPL-2.0-only |
a3ed20b4 | 6 | # |
a3ed20b4 CB |
7 | |
8 | TEST_DESC="Kernel tracer - All events" | |
9 | ||
10 | CURDIR=$(dirname $0)/ | |
11 | TESTDIR=$CURDIR/../.. | |
12 | NUM_TESTS=8 | |
13 | ||
e9826a9d FD |
14 | TESTCMD="/bin/true" |
15 | ||
a3ed20b4 CB |
16 | source $TESTDIR/utils/utils.sh |
17 | ||
a3ed20b4 CB |
18 | function test_all_event() |
19 | { | |
8d5a3312 | 20 | local TRACE_PATH=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") |
a3ed20b4 CB |
21 | SESSION_NAME="kernel_all_events_basic" |
22 | ||
bf6ae429 | 23 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
a3ed20b4 CB |
24 | |
25 | lttng_enable_kernel_event $SESSION_NAME | |
26 | ||
e563bbdb | 27 | start_lttng_tracing_ok |
e9826a9d FD |
28 | |
29 | # Running a process and waiting for its completion forces the triggering of a | |
30 | # sched_switch event | |
31 | eval ${TESTCMD} | |
96340a01 | 32 | stop_lttng_tracing_ok |
a3ed20b4 CB |
33 | |
34 | validate_trace "sched_switch" $TRACE_PATH | |
35 | ||
67b4c664 | 36 | destroy_lttng_session_ok $SESSION_NAME |
a3ed20b4 CB |
37 | |
38 | rm -rf $TRACE_PATH | |
39 | } | |
40 | ||
41 | # MUST set TESTDIR before calling those functions | |
42 | plan_tests $NUM_TESTS | |
43 | ||
e3bef725 CB |
44 | print_test_banner "$TEST_DESC" |
45 | ||
a3ed20b4 CB |
46 | if [ "$(id -u)" == "0" ]; then |
47 | isroot=1 | |
48 | else | |
49 | isroot=0 | |
50 | fi | |
51 | ||
52 | skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || | |
53 | { | |
0159fa50 | 54 | validate_lttng_modules_present |
a3ed20b4 CB |
55 | start_lttng_sessiond |
56 | ||
57 | test_all_event | |
58 | ||
59 | stop_lttng_sessiond | |
60 | } |