aboutsummaryrefslogtreecommitdiff
path: root/lib/blkid/test_probe.in
blob: 02d42bb2550aef12142db227aa08dd3f3b04b7c7 (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
36
37
38
39
40

TESTS=$*

if test "$TESTS"x = x ; then
	for i in $SRCDIR/tests/*.img.bz2
	do
		TESTS="$TESTS `basename $i .img.bz2`"
	done
fi

mkdir -p tests

for i in $TESTS
do
	printf "%s: " $i
	if test ! -f $SRCDIR/tests/$i.img.bz2 -a \
		! -f $SRCDIR/tests/$i.results ; 
	then
		echo "non-existent"
		continue
	fi
	bunzip2 < $SRCDIR/tests/$i.img.bz2 > /tmp/test.img.$$
	./tst_probe /tmp/test.img.$$ > tests/$i.out
	/bin/rm -f /tmp/test.img.$$ tests/$i.ok tests/$i.failed
	cmp -s tests/$i.out $SRCDIR/tests/$i.results
	if [ $? = 0 ];  then
		echo ok
		touch tests/$i.ok
	else	
		echo failed
		diff -c tests/$i.out $SRCDIR/tests/$i.results > tests/$i.failed
	fi
done

num_ok=`ls tests/*.ok 2>/dev/null | wc -l`
num_failed=`ls tests/*.failed 2>/dev/null | wc -l`

echo "$num_ok tests succeeded	$num_failed tests failed"

test "$num_failed" -eq 0 || exit 1