test_probe.in revision 7f6a74b6d6bba48d5c9410dc28f8038ea8cfa979
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/tmp
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 > tests/tmp/test.img.$$
23	if [ "$i" = "swap0" ]; then
24		# swap is native-endian, so regenerate before testing
25		dd if=/dev/zero of=tests/tmp/test.img.$$ bs=16k count=64
26		mkswap -v0 tests/tmp/test.img.$$ > /dev/null
27	elif [ "$i" = "swap1" ]; then
28		# swap is native-endian, so regenerate before testing
29		dd if=/dev/zero of=tests/tmp/test.img.$$ bs=16k count=64
30		mkswap -v1 -L SWAP-TEST -U 8ff8e77f-8553-485e-8656-58be67a81666 tests/tmp/test.img.$$ >/dev/null
31	fi
32	./tst_probe tests/tmp/test.img.$$ > tests/$i.out
33	/bin/rm -f tests/tmp/test.img.$$ tests/$i.ok tests/$i.failed
34	cmp -s tests/$i.out $SRCDIR/tests/$i.results
35	if [ $? = 0 ];  then
36		echo ok
37		touch tests/$i.ok
38	else	
39		echo failed
40		diff -c tests/$i.out $SRCDIR/tests/$i.results > tests/$i.failed
41	fi
42done
43
44num_ok=`ls tests/*.ok 2>/dev/null | wc -l`
45num_failed=`ls tests/*.failed 2>/dev/null | wc -l`
46
47echo "$num_ok tests succeeded	$num_failed tests failed"
48
49test "$num_failed" -eq 0 || exit 1
50