summaryrefslogtreecommitdiff
path: root/test/runtests.sh
blob: b2e55268f0e53ffc21f4e8ad340ff29ee7b550b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

TESTS="$@"
RET=0

TIMEOUT=30
FAILED=""

do_kmsg="yes"
if ! [ $(id -u) = 0 ]; then
	do_kmsg="no"
fi

for t in $TESTS; do
	if [ "$do_kmsg" = "yes" ]; then
		echo Running test $t | tee > /dev/kmsg
	else
		echo Running test $t
	fi
	timeout -s INT $TIMEOUT ./$t
	r=$?
	if [ "${r}" -eq 124 ]; then
		echo "Test $t timed out (may not be a failure)"
	elif [ "${r}" -ne 0 ]; then
		echo Test $t failed
		FAILED="$FAILED $t"
		RET=1
	fi
done

if [ "${RET}" -ne 0 ]; then
	echo "Tests $FAILED failed"
fi

exit $RET