| 1 | #!/bin/bash |
| 2 | |
| 3 | SESSIOND_BIN="lttng-sessiond" |
| 4 | TESTDIR=$(dirname $0)/.. |
| 5 | |
| 6 | source $TESTDIR/utils.sh |
| 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 |
| 16 | ./$bin $tmpdir |
| 17 | # Test must return 0 to pass. |
| 18 | if [ $? -ne 0 ]; then |
| 19 | exit_code=1 |
| 20 | break |
| 21 | fi |
| 22 | done |
| 23 | |
| 24 | # Cleaning up |
| 25 | rm -rf $tmpdir |
| 26 | } |
| 27 | |
| 28 | function check_lttng_modules () |
| 29 | { |
| 30 | local out=`lsmod | grep lttng` |
| 31 | if [ -z "$out" ]; then |
| 32 | echo "LTTng modules not detected. Aborting kernel tests!" |
| 33 | echo "" |
| 34 | # Exit status 0 so the tests can continue |
| 35 | exit 0 |
| 36 | fi |
| 37 | } |
| 38 | |
| 39 | echo -e "\n--------------------------------------------------" |
| 40 | echo -e "Kernel tracer - Testing lttng client (liblttngctl)" |
| 41 | echo -e "--------------------------------------------------" |
| 42 | |
| 43 | # Detect lttng-modules installed |
| 44 | |
| 45 | check_lttng_modules |
| 46 | |
| 47 | # Simply wait for the session daemon bootstrap |
| 48 | sleep 1 |
| 49 | |
| 50 | start_tests |
| 51 | |
| 52 | exit $exit_code |