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