Commit | Line | Data |
---|---|---|
a3ed20b4 CB |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com> | |
4 | # | |
5 | # This program is free software; you can redistribute it and/or modify it | |
6 | # under the terms of the GNU General Public License, version 2 only, as | |
7 | # published by the Free Software Foundation. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | # more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License along with | |
15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | |
16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | ||
18 | TEST_DESC="Kernel tracer - All events" | |
19 | ||
20 | CURDIR=$(dirname $0)/ | |
21 | TESTDIR=$CURDIR/../.. | |
22 | NUM_TESTS=8 | |
23 | ||
e9826a9d FD |
24 | TESTCMD="/bin/true" |
25 | ||
a3ed20b4 CB |
26 | source $TESTDIR/utils/utils.sh |
27 | ||
a3ed20b4 CB |
28 | function test_all_event() |
29 | { | |
30 | TRACE_PATH=$(mktemp -d) | |
31 | SESSION_NAME="kernel_all_events_basic" | |
32 | ||
bf6ae429 | 33 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
a3ed20b4 CB |
34 | |
35 | lttng_enable_kernel_event $SESSION_NAME | |
36 | ||
e563bbdb | 37 | start_lttng_tracing_ok |
e9826a9d FD |
38 | |
39 | # Running a process and waiting for its completion forces the triggering of a | |
40 | # sched_switch event | |
41 | eval ${TESTCMD} | |
96340a01 | 42 | stop_lttng_tracing_ok |
a3ed20b4 CB |
43 | |
44 | validate_trace "sched_switch" $TRACE_PATH | |
45 | ||
67b4c664 | 46 | destroy_lttng_session_ok $SESSION_NAME |
a3ed20b4 CB |
47 | |
48 | rm -rf $TRACE_PATH | |
49 | } | |
50 | ||
51 | # MUST set TESTDIR before calling those functions | |
52 | plan_tests $NUM_TESTS | |
53 | ||
e3bef725 CB |
54 | print_test_banner "$TEST_DESC" |
55 | ||
a3ed20b4 CB |
56 | if [ "$(id -u)" == "0" ]; then |
57 | isroot=1 | |
58 | else | |
59 | isroot=0 | |
60 | fi | |
61 | ||
62 | skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || | |
63 | { | |
64 | start_lttng_sessiond | |
65 | ||
66 | test_all_event | |
67 | ||
68 | stop_lttng_sessiond | |
69 | } |