Add lttng-modules detection for tests
[lttng-tools.git] / tests / lttng / run-kernel-tests.sh
... / ...
CommitLineData
1#!/bin/bash
2
3SESSIOND_BIN="ltt-sessiond"
4
5tmpdir=`mktemp -d`
6tests=( kernel_event_basic kernel_all_events_basic )
7exit_code=0
8
9function start_tests ()
10{
11 for bin in ${tests[@]};
12 do
13 ./$bin $tmpdir
14 # Test must return 0 to pass.
15 if [ $? -ne 0 ]; then
16 exit_code=1
17 break
18 fi
19 # Cleaning up
20 rm -rf $tmpdir
21 done
22}
23
24function check_lttng_modules ()
25{
26 local out=`modprobe -l | grep lttng`
27 if [ -z "$out" ]; then
28 echo "LTTng modules not detected. Aborting kernel tests!"
29 echo ""
30 # Exit status 0 so the tests can continue
31 exit 0
32 fi
33}
34
35echo -e "\n--------------------------------------------------"
36echo -e "Kernel tracer - Testing lttng client (liblttngctl)"
37echo -e "--------------------------------------------------"
38
39# Detect lttng-modules installed
40
41check_lttng_modules
42
43if [ -z $(pidof $SESSIOND_BIN) ]; then
44 echo -n "Starting session daemon... "
45 ../ltt-sessiond/$SESSIOND_BIN --daemonize --quiet
46 if [ $? -eq 1 ]; then
47 echo -e '\e[1;31mFAILED\e[0m'
48 rm -rf $tmpdir
49 exit 1
50 else
51 echo -e "\e[1;32mOK\e[0m"
52 fi
53fi
54
55PID_SESSIOND=`pidof lt-$SESSIOND_BIN`
56
57# Simply wait for the session daemon bootstrap
58sleep 1
59
60start_tests
61
62echo -e -n "\nKilling session daemon... "
63kill $PID_SESSIOND >/dev/null 2>&1
64if [ $? -eq 1 ]; then
65 echo -e '\e[1;31mFAILED\e[0m'
66else
67 echo -e "\e[1;32mOK\e[0m"
68fi
69
70exit $exit_code
This page took 0.023551 seconds and 4 git commands to generate.