test_probe.in revision 0a84e9cae698b8ea5c3389429126c25816986d81
1
2TESTS=$*
3
4if test "$TESTS"x = x ; then
5	for i in $SRCDIR/tests/*.img.bz2
6	do
7		TESTS="$TESTS `basename $i .img.bz2`"
8	done
9fi
10
11mkdir -p tests
12
13for i in $TESTS
14do
15	printf "%s: " $i
16	if test ! -f $SRCDIR/tests/$i.img.bz2 -a \
17		! -f $SRCDIR/tests/$i.results ; 
18	then
19		echo "non-existent"
20		continue
21	fi
22	bunzip2 < $SRCDIR/tests/$i.img.bz2 > /tmp/test.img.$$
23	./tst_probe /tmp/test.img.$$ > tests/$i.out
24	/bin/rm -f /tmp/test.img.$$ tests/$i.ok tests/$i.failed
25	cmp -s tests/$i.out $SRCDIR/tests/$i.results
26	if [ $? = 0 ];  then
27		echo ok
28		touch tests/$i.ok
29	else	
30		echo failed
31		diff -c tests/$i.out $SRCDIR/tests/$i.results > tests/$i.failed
32	fi
33done
34
35num_ok=`ls tests/*.ok 2>/dev/null | wc -l`
36num_failed=`ls tests/*.failed 2>/dev/null | wc -l`
37
38echo "$num_ok tests succeeded	$num_failed tests failed"
39
40test "$num_failed" -eq 0 || exit 1
41