Commit | Line | Data |
---|---|---|
1b368955 JD |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2013 Julien Desfossez <julien.desfossez@efficios.com> | |
4 | # David Goulet <dgoulet@efficios.com> | |
5 | # | |
6 | # This library is free software; you can redistribute it and/or modify it under | |
7 | # the terms of the GNU Lesser General Public License as published by the Free | |
8 | # Software Foundation; version 2.1 of the License. | |
9 | # | |
10 | # This library is distributed in the hope that it will be useful, but WITHOUT | |
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
12 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
13 | # details. | |
14 | # | |
15 | # You should have received a copy of the GNU Lesser General Public License | |
16 | # along with this library; if not, write to the Free Software Foundation, Inc., | |
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | ||
19 | TEST_DESC="Live - Kernel space tracing" | |
20 | ||
21 | CURDIR=$(dirname $0)/ | |
22 | TESTDIR=$CURDIR/../../../ | |
23 | SESSIOND_BIN="lttng-sessiond" | |
24 | RELAYD_BIN="lttng-relayd" | |
25 | LTTNG_BIN="lttng" | |
26 | BABELTRACE_BIN="babeltrace" | |
27 | NR_ITER=1 | |
28 | NR_USEC_WAIT=1 | |
29 | DELAY_USEC=2000000 | |
30 | ||
31 | SESSION_NAME="live" | |
32 | EVENT_NAME="sched_switch" | |
33 | ||
34 | TRACE_PATH=$(mktemp -d) | |
35 | ||
36 | DIR=$(readlink -f $TESTDIR) | |
37 | ||
38 | source $TESTDIR/utils/utils.sh | |
39 | ||
40 | function setup_live_tracing() | |
41 | { | |
42 | # Create session with default path | |
43 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \ | |
44 | -U net://localhost >/dev/null 2>&1 | |
45 | ||
46 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -k >/dev/null 2>&1 | |
47 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $SESSION_NAME >/dev/null 2>&1 | |
48 | } | |
49 | ||
50 | function clean_live_tracing() | |
51 | { | |
52 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $SESSION_NAME >/dev/null 2>&1 | |
53 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $SESSION_NAME >/dev/null 2>&1 | |
54 | rm -rf $TRACE_PATH | |
55 | } | |
56 | ||
57 | # Need root access for kernel tracing. | |
58 | if [ "$(id -u)" == "0" ]; then | |
59 | isroot=1 | |
60 | else | |
61 | echo "Root access is needed. Skipping all tests." | |
62 | exit 0 | |
63 | fi | |
64 | ||
05aa48da MD |
65 | start_lttng_sessiond_notap |
66 | start_lttng_relayd_notap "-o $TRACE_PATH" | |
1b368955 JD |
67 | |
68 | setup_live_tracing | |
69 | ||
70 | # Start the live test | |
71 | $TESTDIR/regression/tools/live/live_test | |
72 | ||
73 | clean_live_tracing | |
74 | ||
05aa48da MD |
75 | stop_lttng_relayd_notap |
76 | stop_lttng_sessiond_notap |