1#!/bin/sh
2# Without --ignore-exit, the tap harness causes any FAILs within a
3# test plan to raise ERRORs; this is just noise.
4
5#Detecting whether current system has lttng kernel modules
6LTTNG_KMOD_PATH=/lib/modules/$(uname -r)/kernel/lttng-modules/lttng-tracer.ko
7function validate_lttng_modules_present()
8{
9	# Check for loadable modules.
10	if [ -f "$LTTNG_KMOD_PATH" ]; then
11		return 0
12	fi
13
14	# Check for builtin modules.
15	ls /proc/lttng > /dev/null 2>&1
16	if [ $? -eq 0 ]; then
17		return 0
18	fi
19
20	return 1
21}
22
23export LD_LIBRARY_PATH=FIXMEPTESTPATH/tests/utils/testapp/userspace-probe-elf-binary/.libs
24makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=FIXMEPTESTPATH top_builddir=FIXMEPTESTPATH"
25
26#If current system doesn't have lttng kernel modules, disable lttng kernel related tests.
27validate_lttng_modules_present || {
28	makeargs="$makeargs LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1"
29}
30
31make -k -t all >error.log 2>&1
32# Can specify a test e.g.:
33# -C tests/regression/ check TESTS='kernel/test_callstack'
34make -k -s $makeargs check 2>error.log | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g'
35exitcode=$?
36if [ -e error.log ]; then
37    cat error.log
38fi
39if [ -e tests/unit/test-suite.log ]; then
40    cat tests/unit/test-suite.log
41fi
42if [ -e tests/regression/test-suite.log ]; then
43    cat tests/regression/test-suite.log
44fi
45exit $exitcode
46