Commit | Line | Data |
---|---|---|
8e0dbb65 DG |
1 | #!/bin/bash |
2 | ||
32258573 | 3 | SESSIOND_BIN="lttng-sessiond" |
2e6a03f6 | 4 | CURDIR=$(dirname $0) |
9ac429ef | 5 | TESTDIR=$CURDIR/../.. |
d3e8f6bb | 6 | |
9ac429ef | 7 | source $TESTDIR/utils/utils.sh |
8e0dbb65 DG |
8 | |
9 | tmpdir=`mktemp -d` | |
2e6a03f6 | 10 | tests=( $CURDIR/kernel_event_basic $CURDIR/kernel_all_events_basic ) |
8e0dbb65 DG |
11 | exit_code=0 |
12 | ||
13 | function start_tests () | |
14 | { | |
15 | for bin in ${tests[@]}; | |
16 | do | |
2e6a03f6 DG |
17 | if [ ! -e $bin ]; then |
18 | echo -e "$bin not found, passing" | |
19 | continue | |
20 | fi | |
21 | ||
fb3268e3 | 22 | start_lttng_sessiond |
355f483d | 23 | |
8e0dbb65 DG |
24 | ./$bin $tmpdir |
25 | # Test must return 0 to pass. | |
26 | if [ $? -ne 0 ]; then | |
27 | exit_code=1 | |
fb3268e3 | 28 | stop_lttng_sessiond |
8e0dbb65 DG |
29 | break |
30 | fi | |
fb3268e3 | 31 | stop_lttng_sessiond |
8e0dbb65 | 32 | done |
d3e8f6bb DG |
33 | |
34 | # Cleaning up | |
35 | rm -rf $tmpdir | |
8e0dbb65 DG |
36 | } |
37 | ||
38 | function check_lttng_modules () | |
39 | { | |
3f222b34 | 40 | local out=`ls /lib/modules/$(uname -r)/extra | grep lttng` |
8e0dbb65 DG |
41 | if [ -z "$out" ]; then |
42 | echo "LTTng modules not detected. Aborting kernel tests!" | |
43 | echo "" | |
44 | # Exit status 0 so the tests can continue | |
45 | exit 0 | |
46 | fi | |
47 | } | |
48 | ||
c38b5107 CB |
49 | |
50 | TEST_DESC="Testing Kernel tracer" | |
51 | ||
52 | print_test_banner "$TEST_DESC" | |
8e0dbb65 DG |
53 | |
54 | # Detect lttng-modules installed | |
8e0dbb65 DG |
55 | check_lttng_modules |
56 | ||
8e0dbb65 DG |
57 | start_tests |
58 | ||
8e0dbb65 | 59 | exit $exit_code |