@echo " LD $@"
@$(CC) -o blkid ../../misc/blkid.o libblkid.a $(LIBUUID)
+test_probe: test_probe.in Makefile
+ @echo "Creating test_probe..."
+ @echo "#!/bin/sh" > test_probe
+ @echo "SRCDIR=@srcdir@" >> test_probe
+ @cat $(srcdir)/test_probe.in >> test_probe
+ @chmod +x test_probe
+
check:: all tst_cache tst_dev tst_devname tst_devno tst_getsize tst_probe \
- tst_read tst_resolve tst_save tst_tag
+ tst_read tst_resolve tst_save tst_tag test_probe
+ ./test_probe
blkid.pc: $(srcdir)/blkid.pc.in $(top_builddir)/config.status
@echo " CONFIG.STATUS $@"
done
clean::
- $(RM) -f \#* *.s *.o *.orig *.a *~ *.bak tst_* core profiled/* \
+ $(RM) -f \#* *.s *.o *.orig *.a *~ *.bak tst_* tests/*.out tests/*.ok \
+ tests/*.img results test_probe core profiled/* \
checker/* blkid_types.h ../libblkid.a ../libblkid_p.a \
$(SMANPAGES) blkid
+ -rmdir tests
mostlyclean:: clean
distclean:: clean
blkid_cache cache;
int ret;
- blkid_debug_mask = DEBUG_ALL;
if (argc != 2) {
fprintf(stderr, "Usage: %s device\n"
"Probe a single device to determine type\n", argv[0]);
printf("%s: %s has an unsupported type\n", argv[0], argv[1]);
return (1);
}
- printf("%s is type %s\n", argv[1], dev->bid_type ?
- dev->bid_type : "(null)");
+ printf("TYPE='%s'\n", dev->bid_type ? dev->bid_type : "(null)");
if (dev->bid_label)
- printf("\tlabel is '%s'\n", dev->bid_label);
+ printf("LABEL='%s'\n", dev->bid_label);
if (dev->bid_uuid)
- printf("\tuuid is %s\n", dev->bid_uuid);
+ printf("UUID='%s'\n", dev->bid_uuid);
blkid_free_dev(dev);
return (0);
--- /dev/null
+
+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
+ echo -n "$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
--- /dev/null
+TYPE='cramfs'
+LABEL='test-cram'
--- /dev/null
+TYPE='ext2'
+LABEL='test-ext2'
+UUID='22f0eac3-5c89-4ec1-9076-60799119aaea'
--- /dev/null
+TYPE='ext3'
+LABEL='test-ext3'
+UUID='35f66dab-477e-4090-a872-95ee0e493ad6'
--- /dev/null
+TYPE='vfat'
+LABEL='TEST-FAT'
+UUID='DEAD-BEEF'
--- /dev/null
+TYPE='vfat'
+UUID='8CB5-BA49'
--- /dev/null
+TYPE='iso9660'
+LABEL='test-iso'
--- /dev/null
+TYPE='jbd'
+UUID='0d7a07df-7b06-4829-bce7-3b9c3ece570c'
--- /dev/null
+TYPE='jfs'
+LABEL='test-jfs'
+UUID='9bf7b82e-7583-4c74-99a4-189a691f27b5'
--- /dev/null
+TYPE='minix'
--- /dev/null
+TYPE='ocfs2'
+LABEL='test-ocfs2'
+UUID='6b6bfbea-3a79-4f0c-b166-a20776102445'
--- /dev/null
+TYPE='reiserfs'
+LABEL='TESTREISER'
+UUID='9efe7863-b124-46dc-ad68-8ecd04230a7b'
--- /dev/null
+TYPE='reiser4'
+LABEL='TESTR4'
+UUID='9722633c-d69a-4881-b1c8-bedecbbf39d2'
--- /dev/null
+TYPE='romfs'
+LABEL='test-romfs'
--- /dev/null
+TYPE='vfat'
+LABEL='TESTVFAT'
+UUID='1423-AAE1'
--- /dev/null
+TYPE='swap'
--- /dev/null
+TYPE='swap'
+LABEL='SWAP-TEST'
+UUID='8ff8e77f-8553-485e-8656-58be67a81666'
--- /dev/null
+TYPE='xfs'
+LABEL='test-xfs'
+UUID='8c8a0a5a-9f57-492e-9610-45a61f38f58a'