e2fsprogs/lib/blkid/test_probe.in

47 lines
1.1 KiB
Plaintext
Raw Normal View History

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/tmp
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 > tests/tmp/test.img.$$
# swap is native-endian, so regenerate before testing
if [ "$i" = "swap0" ]; then
mkswap -v0 tests/tmp/test.img.$$ > /dev/null
elif [ "$i" = "swap1" ]; then
mkswap -v1 -L SWAP-TEST -U 8ff8e77f-8553-485e-8656-58be67a81666 tests/tmp/test.img.$$ >/dev/null
fi
./tst_probe tests/tmp/test.img.$$ > tests/$i.out
/bin/rm -f tests/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