]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tests: use make rules to run tests in parallel
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 28 May 2012 22:58:24 +0000 (16:58 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 29 May 2012 12:41:26 +0000 (08:41 -0400)
Change the e2fsck/mke2fs/tune2fs/e2image/debugfs regression tests to
be driven by Makefile rules instead of by a script loop.  This allows
the tests to be run in parallel like a build and reduces testing time
significantly.

One major change to the tests themselves is to printing the test name,
description, and status together after the test has passed or failed,
to avoid mixing lines from the tests.  The other major change is to
use unique temporary filenames for each test, which was mostly handled
already via b4db1e4c7461a50e18c9fd135b9f1ba6f27e4390, but in some
cases temporary files are changed to use $test_name.tmp to avoid any
collision between running tests.

On my old 2-CPU system it reduced the testing time from 160s to 40s.
Much of the savings is from the MMP test delays running in parallel.
It still takes the time of the slowest test, f_mmp_garbage, though
there will be ongoing benefit in the future as more tests are added
since the wallclock time will not increase linearly for each test.

Tests were run with various combinations of "make -j", and "make -j2"
through "make -j44" repeatedly without any test failures.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
39 files changed:
.gitignore
tests/Makefile.in
tests/d_loaddump/expect
tests/d_loaddump/script
tests/defaults/e_script
tests/e_brel_bma/script
tests/e_icount_normal/name
tests/e_irel_ima/script
tests/f_dup4/script
tests/f_dup_de/script
tests/f_dup_resize/script
tests/f_ext_journal/name [new file with mode: 0644]
tests/f_h_badnode/script
tests/f_h_badroot/script
tests/f_h_normal/script
tests/f_h_reindex/script
tests/f_h_unsigned/script
tests/f_imagic_fs/script
tests/f_mmp/script
tests/f_mmp_garbage/script
tests/f_rehash_dir/name [new file with mode: 0644]
tests/f_resize_inode/script
tests/f_uninit_last_uninit/script
tests/f_unused_itable/name
tests/i_e2image/script
tests/m_mkfs_overhead/script
tests/m_mmp/script
tests/r_inline_xattr/script
tests/r_move_itable/script
tests/r_resize_inode/script
tests/run_e2fsck
tests/t_ext_jnl_rm/script
tests/t_mmp_1on/script
tests/t_mmp_2off/script
tests/test_one.in [new file with mode: 0644]
tests/test_post [new file with mode: 0755]
tests/test_script.in
tests/u_mke2fs/script
tests/u_tune2fs/script

index 2d1a13eee7d07eee8cde3daedb2e6cc2a9ed8886..588c9e732245bcb6393157c94519ca97cf37b148 100644 (file)
@@ -177,9 +177,10 @@ tests/progs/test_icount_cmds.c
 tests/*.ok
 tests/*.failed
 tests/*.log
-tests/*.log
+tests/*.tmp
 tests/mke2fs.conf
 tests/test_script
+tests/test_one
 util/gen-tarball
 util/subst
 util/subst.conf
index 9dd10340157b4a9eddbac4c883c1684930211d26..b9df3b029b4c906ac611bdd1a4b85bff2aceba5e 100644 (file)
@@ -11,33 +11,45 @@ INSTALL = @INSTALL@
 
 @MCONFIG@
 
-all:: @DO_TEST_SUITE@
+all:: @DO_TEST_SUITE@ test_one test_script
 
-test_script: test_script.in Makefile mke2fs.conf
+test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
+       @echo "Creating test_one script..."
+       @echo "#!/bin/sh" > test_one
+@HTREE_CMT@    @echo "HTREE=y" >> test_one
+       @echo "SRCDIR=@srcdir@" >> test_one
+       @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one
+       @cat $(srcdir)/test_one.in >> test_one
+       @chmod +x test_one
+
+test_script: test_one test_script.in Makefile mke2fs.conf
        @echo "Creating test_script..."
        @echo "#!/bin/sh" > test_script
-@HTREE_CMT@    @echo "HTREE=y" >> test_script
-       @echo 'EGREP="@EGREP@"' >> test_script
        @echo "SRCDIR=@srcdir@" >> test_script
-       @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_script
        @cat $(srcdir)/test_script.in >> test_script
        @chmod +x test_script
 
 mke2fs.conf: $(srcdir)/mke2fs.conf.in
        $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf
 
-check:: test_script
+.PHONY : test_pre test_post check always_run
+
+TESTS=$(wildcard $(srcdir)/[a-z]_*)
+$(TESTS):: test_one always_run
+       @./test_one $@
+
+test_pre:
+       @$(RM) -f *.failed
        @echo "Running e2fsprogs test suite..."
        @echo " "
-       @./test_script
 
-check-failed:
-       @a=`/bin/ls *.failed 2> /dev/null | sed -e 's/.failed//'`; \
-       if test "$$a"x == x ; then \
-               echo "No failed tests" ; \
-       else \
-               ./test_script $$a ; \
-       fi
+test_post: test_pre $(TESTS)
+       @$(srcdir)/test_post
+
+check:: test_pre test_post test_script
+
+check-failed: $(basename $(wildcard *.failed))
+       @$(srcdir)/test_post
 
 
 TDIR=f_testnew
@@ -54,9 +66,9 @@ testnew:
 EXPECT1=${TDIR}/expect.1
 EXPECT2=${TDIR}/expect.2
 # Target which generates the expect files for the new testcase.
-testend: test_script ${TDIR}/image
+testend: test_one ${TDIR}/image
        gzip -9 ${TDIR}/image
-       @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_script ${TDIR}
+       @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_one ${TDIR}
        @echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***"
        @cat ${EXPECT1}
        @echo "*** output from second e2fsck run (${EXPECT2}) ***"
@@ -66,7 +78,7 @@ testend: test_script ${TDIR}/image
        @echo "If all is well, edit ${TDIR}/name and rename ${TDIR}."
 
 clean::
-       $(RM) -f *~ *.log *.new *.failed *.ok test.img test_script mke2fs.conf
+       $(RM) -f *~ *.log *.new *.failed *.ok *.tmp test_one test_script mke2fs.conf
 
 distclean:: clean
        $(RM) -f Makefile
index e142eac30363f36222076c71c48b4cec46f3c506..f70df88d2263a2d84fce2d659ec7ca71cc7c826d 100644 (file)
@@ -1,7 +1,7 @@
 debugfs load/dump test
 mke2fs -Fq -b 1024 test.img 512
 Exit status is 0
-debugfs -R ''write test.data test_data'' -w test.img
+debugfs -R ''write d_loaddump.tmp test_data'' -w test.img
 Allocated inode: 12
 Exit status is 0
 e2fsck -yf -N test_filesys
@@ -12,7 +12,7 @@ Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 test_filesys: 12/64 files (0.0% non-contiguous), 158/512 blocks
 Exit status is 0
-debugfs -R ''dump test_data test.verify'' test.img
+debugfs -R ''dump test_data d_loaddump.ver.tmp'' test.img
 Exit status is 0
-cmp test.data test.verify
+cmp d_loaddump.tmp d_loaddump.ver.tmp
 Exit status is 0
index 48253752bdc6c65f685de6f5df10f106b5e963bb..9b687eb497d8a5d56ad51538c4b08db8d8ab1953 100644 (file)
@@ -4,8 +4,8 @@ OUT=$test_name.log
 EXP=$test_dir/expect
 VERIFY_FSCK_OPT=-yf
 
-TEST_DATA=test.data
-VERIFY_DATA=test.verify
+TEST_DATA=$test_name.tmp
+VERIFY_DATA=$test_name.ver.tmp
 
 echo "debugfs load/dump test" > $OUT
 
@@ -47,21 +47,20 @@ echo Exit status is $status >> $OUT
 # Do the verification
 #
 
-rm -f $test_name.ok $test_name.failed $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new
+rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new
 cmp -s $OUT $EXP
 status=$?
 
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
 fi
 
 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index b9150ba751a01cea8bfbebe584081d4de37b0d29..8c9cfb6ab8791c50dbc96c12ec0c55f3a8f684e1 100644 (file)
@@ -37,10 +37,10 @@ status=$?
 rm -f $test_name.failed $test_name.ok
 
 if [ "$status" = 0 ] ; then
-    echo "ok"
+    echo "$test_name: $test_description: ok"
     touch $test_name.ok
 else
-    echo "failed"
+    echo "$test_name: $test_description: failed"
     diff $DIFF_OPTS $EXPECT $OUT > $test_name.failed
 fi
 
index c046675eeb800b26afe25d549539040d7fd6030c..037e2fb08409bb0d481f06048d4a65b299a10338 100644 (file)
@@ -1,2 +1 @@
-rm -f $test_name.ok $test_name.failed
-echo "skipped"
+echo "$test_name: $test_description: skipped"
index eafa80204e5bf8d424147dd28591fe815aae17e2..13178768fdc4373f3edd4bc70c371acae2798f72 100644 (file)
@@ -1 +1 @@
-inode counting abstraction optimized for storing inode counts
+inode counting structure optimized for low counts
index c046675eeb800b26afe25d549539040d7fd6030c..037e2fb08409bb0d481f06048d4a65b299a10338 100644 (file)
@@ -1,2 +1 @@
-rm -f $test_name.ok $test_name.failed
-echo "skipped"
+echo "$test_name: $test_description: skipped"
index 290dcc923b0758591f54b40e86dc67d0cc55eb9d..7c45bed99aaa58827d58de240cf4ecc7d07baa83 100644 (file)
@@ -1,7 +1,7 @@
 if test -x $DEBUGFS_EXE; then
 
 SKIP_GUNZIP="true"
-TEST_DATA="test.data"
+TEST_DATA="$test_name.tmp"
 
 echo "/ Murphy Magic.  The SeCrEt of the UnIvErSe is 43, NOT 42" > $TEST_DATA
 
@@ -52,6 +52,5 @@ rm -f $TEST_DATA
 unset E2FSCK_TIME TEST_DATA
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index d331003f1e721d0a93b9e776d7c85c854e192f17..60378cdc94b8a667f7d4b47bda216caf6ca85bc8 100644 (file)
@@ -12,6 +12,5 @@ fi
 rm -f "$TMPFILE".gz
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index 3f87cbba1ff0939d89ec5ab9934ea2b2cc457b7c..34ec4aea3af04156578855c99fe7f39495760950 100644 (file)
@@ -1,7 +1,7 @@
 if test -x $DEBUGFS_EXE; then
 
 SKIP_GUNZIP="true"
-TEST_DATA="test.data"
+TEST_DATA="$test_name.tmp"
 
 dd if=$TEST_BITS of=$TEST_DATA bs=63k count=1 conv=sync > /dev/null 2>&1
 
@@ -26,6 +26,5 @@ rm -f $TEST_DATA
 unset E2FSCK_TIME TEST_DATA
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
diff --git a/tests/f_ext_journal/name b/tests/f_ext_journal/name
new file mode 100644 (file)
index 0000000..10e950c
--- /dev/null
@@ -0,0 +1 @@
+test external journal device
index 9eec08409ce6b098afe03269102ad051c80974ed..e5fc6b2bda247a57ea42de6136e3c08f31477bbd 100644 (file)
@@ -1,6 +1,5 @@
 if test "$HTREE"x = yx ; then
 . $cmd_dir/run_e2fsck
 else
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
index 9eec08409ce6b098afe03269102ad051c80974ed..e5fc6b2bda247a57ea42de6136e3c08f31477bbd 100644 (file)
@@ -1,6 +1,5 @@
 if test "$HTREE"x = yx ; then
 . $cmd_dir/run_e2fsck
 else
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
index 9eec08409ce6b098afe03269102ad051c80974ed..e5fc6b2bda247a57ea42de6136e3c08f31477bbd 100644 (file)
@@ -1,6 +1,5 @@
 if test "$HTREE"x = yx ; then
 . $cmd_dir/run_e2fsck
 else
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
index 9eec08409ce6b098afe03269102ad051c80974ed..e5fc6b2bda247a57ea42de6136e3c08f31477bbd 100644 (file)
@@ -1,6 +1,5 @@
 if test "$HTREE"x = yx ; then
 . $cmd_dir/run_e2fsck
 else
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
index 9eec08409ce6b098afe03269102ad051c80974ed..e5fc6b2bda247a57ea42de6136e3c08f31477bbd 100644 (file)
@@ -1,6 +1,5 @@
 if test "$HTREE"x = yx ; then
 . $cmd_dir/run_e2fsck
 else
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
index 3941be00d85dfac3d53804f470f3c1904882592d..1060f04d1eb350c0b5f9a711608522ad5e2ce3a3 100644 (file)
@@ -5,6 +5,5 @@ PREP_CMD='$DEBUGFS -w -R "feature imagic_inodes" $TMPFILE > /dev/null 2>&1'
 . $cmd_dir/run_e2fsck
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index 3d4a04102567544b64debc223c7baf02f74582a7..1b0ff793fbbd86bfb40169bbe0fdece00465e8c7 100644 (file)
@@ -1,13 +1,12 @@
 FSCK_OPT=-yf
 
-TMPFILE=test.img
-rm -f $test_name.failed $test_name.ok
+TMPFILE=$test_name.tmp
 > $TMPFILE
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
        rm -f $TMPFILE
-       echo "skipped for tmpfs (no O_DIRECT support)"
+       echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
        return 0
 fi
 
@@ -16,7 +15,7 @@ $MKE2FS -q -F -o Linux -b 4096 -O mmp -E mmp_update_interval=1 $TMPFILE 100 >> $
 status=$?
 if [ "$status" != 0 ] ; then
        echo "mke2fs -O mmp failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
@@ -41,7 +40,7 @@ $FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
 status=$?
 if [ "$status" = 0 ] ; then
        echo "e2fsck with MMP as EXT2_MMP_SEQ_FSCK ran!" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return 1
 fi
 
@@ -50,7 +49,7 @@ $TUNE2FS -f -E clear_mmp $TMPFILE >> $test_name.log 2>&1
 status=$?
 if [ "$status" != 0 ] ; then
        echo "tune2fs clearing EXT2_MMP_SEQ_FSCK failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return 1
 fi
 
@@ -59,9 +58,9 @@ $FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
 status=$?
 if [ "$status" != 0 ] ; then
        echo "e2fsck after clearing EXT2_MMP_SEQ_FSCK failed"> $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
-echo "ok"
+echo "$test_name: $test_description: ok"
 rm -f $TMPFILE
index 3b2954bfd6b4704464ee6f570fda965ce384bb7e..02cc12a4280b4ad8002d527c35eeae2309e9e5e0 100644 (file)
@@ -1,13 +1,12 @@
 FSCK_OPT=-yf
 
-TMPFILE=test.img
-rm -f $test_name.failed $test_name.ok
+TMPFILE=$test_name.tmp
 > $TMPFILE
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ] ; then
        rm -f $TMPFILE
-       echo "skipped for tmpfs (no O_DIRECT support)"
+       echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
        return 0
 fi
 
@@ -16,7 +15,7 @@ $MKE2FS -q -F -o Linux -b 4096 -O mmp -E mmp_update_interval=1 $TMPFILE 100 >> $
 status=$?
 if [ "$status" != 0 ] ; then
        echo "mke2fs -O mmp failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
diff --git a/tests/f_rehash_dir/name b/tests/f_rehash_dir/name
new file mode 100644 (file)
index 0000000..a7a869a
--- /dev/null
@@ -0,0 +1 @@
+optimize htree directories
index ca934e9e9c15f900cf86012c159129e880654b43..840432da5c938ad8074b1f1cb1ac423f8372e28e 100644 (file)
@@ -1,10 +1,10 @@
 if test -x $DEBUGFS_EXE; then
 
-printf "e2fsck with resize_inode: "
+test_description="e2fsck with resize_inode"
 FSCK_OPT=-yf
 OUT=$test_name.log
 if [ -f $test_dir/expect.gz ]; then
-       EXP=tmp_expect
+       EXP=$test_name.tmp
        gunzip < $test_dir/expect.gz > $EXP1
 else
        EXP=$test_dir/expect
@@ -126,15 +126,14 @@ sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d'  | tr -d \\015 >> $OUT
 rm -f $OUT.new
 
 
-rm -f $test_name.ok $test_name.failed
 cmp -s $OUT $EXP
 status=$?
 
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
        rm -f tmp_expect
 fi
@@ -142,6 +141,5 @@ fi
 unset IMAGE FSCK_OPT OUT EXP
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index 4fcab1b3f0bb682a4c6617f864d4669aa2a70f7c..2fe4f3a00fb70dc550065d45b5f87041c3399340 100644 (file)
@@ -22,6 +22,5 @@ export E2FSCK_TIME
 unset E2FSCK_TIME
 
 else #if test -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index 39b68d64410287569a853a53053a42ff137cbe0f..e129137cc58b7d982553ab4ca5d7c47ac240a45c 100644 (file)
@@ -1 +1 @@
-Invalid bg_unused_itable shouldn't move files to lost+found
+Don't move files to lost+found for bg_unused_itable
index 9c6ae2af42d68effbe5bd7b4ecf7897d9adb6480..0315ae2092bae1d20b51c6af9a32052938194794 100644 (file)
@@ -1,4 +1,4 @@
-printf "Create/convert raw and qcow2 disk images: "
+test_description="create/convert raw/qcow2 images"
 if test -x $E2IMAGE_EXE; then
 
 ORIG_IMAGES="image1024.orig image2048.orig image4096.orig"
@@ -8,7 +8,7 @@ QCOW2_IMG=_image.qcow2
 QCOW2_TO_RAW=_image.qcow2.raw
 OUT=$test_name.log
 MD5=$SRCDIR/$test_name/$test_name.md5
-MD5_TMP=$test_name.md5tmp
+MD5_TMP=$test_name.md5.tmp
 
 rm -f $test_name/_image.* $MD5_TMP $OUT >/dev/null 2>&1
 
@@ -43,18 +43,15 @@ echo "" >> $OUT
 diff $MD5 $MD5_TMP >> $OUT 2>&1
 
 if [ $? -eq 0 ]; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
-       rm -f $test_name.failed
 else
-       rm -f $test_name.ok
        ln -f $test_name.log $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
 fi
 
 rm -f _image.* $MD5_TMP >/dev/null 2>&1
 
 else #if test -x $E2IMAGE_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
index ff4619962f1a3cc8f58e8172e69a1cea79c51d55..63612a899ffae4325933e025fa88f37a8e6d8fc4 100644 (file)
@@ -1,4 +1,4 @@
-echo -n "test bg overhead calculation: "
+test_description="test bg overhead calculation"
 
 OUT=$test_name.log
 EXP=$test_dir/expect
@@ -17,17 +17,15 @@ $MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d | \
 
 rm -f $TMPFILE
 
-rm -f $test_name.ok $test_name.failed
 cmp -s $OUT $EXP
 status1=$?
 
 if [ "$status1" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
 fi
-rm -f tmp_expect
 
 unset OUT EXP DESCRIPTION FS_SIZE MKE2FS_OPTS MKE2FS_SKIP_PROGRESS
index a0c9deda9d32e1bb4803a7fc96017326b937199c..02b0b4b84c08d59313514034a4b4063cf646f020 100644 (file)
@@ -2,12 +2,12 @@ DESCRIPTION="enable MMP during mke2fs"
 FS_SIZE=65536
 MKE2FS_DEVICE_SECTSIZE=2048
 export MKE2FS_DEVICE_SECTSIZE
-TMPFILE=test.img
+TMPFILE=$test_name.tmp
 > $TMPFILE
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
        rm -f $TMPFILE
-       echo "skipped for tmpfs (no O_DIRECT support)"
+       echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
        return 0
 fi
 MKE2FS_OPTS="-b 4096 -O mmp"
index e4e0f536f3d1c65eb455a1890ec27c26a61aaff1..021088e0e5aed1e25aa06a6919ec66a35977c6fb 100644 (file)
@@ -34,22 +34,20 @@ rm $TMPFILE $OUT.new
 # Do the verification
 #
 
-rm -f $test_name.ok $test_name.failed
 cmp -s $OUT $EXP
 status=$?
 
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
 fi
 
 unset IMAGE FSCK_OPT OUT EXP
 
 else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
-        rm -f $test_name.ok $test_name.failed
-        echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi
 
index 56a861b0f7f0e76c3db827f9975232106f68d5c9..fc8286f65a6aa1775e203dfc8a3182e171042b78 100644 (file)
@@ -3,7 +3,7 @@ if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
 FSCK_OPT=-yf
 OUT=$test_name.log
 if [ -f $test_dir/expect.gz ]; then
-       EXP=tmp_expect
+       EXP=$test_name.tmp
        gunzip < $test_dir/expect.gz > $EXP1
 else
        EXP=$test_dir/expect
@@ -96,23 +96,22 @@ $TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
 echo dumpe2fs test.img >> $OUT
 $DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs >> $OUT
 
-rm -f $test_name.ok $test_name.failed $TMPFILE
+rm -f $TMPFILE
 
 cmp -s $OUT $EXP
 status=$?
 
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
-       rm -f tmp_expect
+       rm -f $test_name.tmp
 fi
 
 unset IMAGE FSCK_OPT OUT EXP
 
 else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index c8db127921d544bfa2c884332834e09d25828e6f..da3c2ede07a6f1feab5a326d97ba84dc1ce021de 100644 (file)
@@ -3,7 +3,7 @@ if test -x $RESIZE2FS_EXE; then
 FSCK_OPT=-yf
 OUT=$test_name.log
 if [ -f $test_dir/expect.gz ]; then
-       EXP=tmp_expect
+       EXP=$test_name.tmp
        gunzip < $test_dir/expect.gz > $EXP1
 else
        EXP=$test_dir/expect
@@ -83,22 +83,21 @@ $TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
 echo dumpe2fs test.img >> $OUT
 $DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs >> $OUT
 
-rm -f $test_name.ok $test_name.failed $TMPFILE
+rm -f $TMPFILE
 cmp -s $OUT $EXP
 status=$?
 
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
-       rm -f tmp_expect
+       rm -f $test_name.tmp
 fi
 
 unset IMAGE FSCK_OPT OUT EXP
 
 else #if test -x $RESIZE2FS; then
-       rm -f $test_name.ok $test_name.failed
-       echo "skipped"
+       echo "$test_name: $test_description: skipped"
 fi 
index 573e01008fd8e0d90f175aff8bd6cdc8b8217051..937a171b0c912d17664997757945fb5a546bb2e9 100644 (file)
@@ -1,5 +1,5 @@
 if [ "$DESCRIPTION"x != x ]; then
-       printf "%s" "$DESCRIPTION: "
+       test_description="$DESCRIPTION"
 fi
 if [ "$IMAGE"x = x ]; then
        IMAGE=$test_dir/image.gz
@@ -23,7 +23,7 @@ fi
 
 if [ "$EXP1"x = x ]; then
        if [ -f $test_dir/expect.1.gz ]; then
-               EXP1=tmp_expect
+               EXP1=$test_name.1.tmp
                gunzip < $test_dir/expect.1.gz > $EXP1
        else
                EXP1=$test_dir/expect.1
@@ -32,7 +32,7 @@ fi
 
 if [ "$EXP2"x = x ]; then
        if [ -f $test_dir/expect.2.gz ]; then
-               EXP2=tmp_expect
+               EXP2=$test_name.2.tmp
                gunzip < $test_dir/expect.2.gz > $EXP2
        else
                EXP2=$test_dir/expect.2
@@ -65,10 +65,6 @@ fi
 
 eval $AFTER_CMD
 
-if [ "$SKIP_UNLINK" != "true" ] ; then
-       rm $TMPFILE
-fi
-
 if [ "$SKIP_VERIFY" != "true" ] ; then
        rm -f $test_name.ok $test_name.failed
        cmp -s $OUT1 $EXP1
@@ -87,10 +83,10 @@ if [ "$SKIP_VERIFY" != "true" ] ; then
        fi
 
        if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
-               echo "ok"
+               echo "$test_name: $test_description: ok"
                touch $test_name.ok
        else
-               echo "failed"
+               echo "$test_name: $test_description: failed"
                diff $DIFF_OPTS $EXP1 $OUT1 > $test_name.failed
                if [ "$ONE_PASS_ONLY" != "true" ]; then
                        diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
index d7217b6ebb6e7f5f3170ae612acf11395d6519f6..b2af80cf081ef21f43e677656c7edcc0b7dc2294 100644 (file)
@@ -1,4 +1,4 @@
-printf "remove missing external journal device: "
+test_description="remove missing external journal device"
 OUT=$test_name.log
 
 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
@@ -17,12 +17,10 @@ echo "tune2fs -f -O ^has_journal $TMPFILE" >> $OUT
 $TUNE2FS -f -O ^has_journal $TMPFILE >> $OUT 2>&1
 $DUMPE2FS -h $TMPFILE >> $OUT 2>&1
 if [ "$(grep 'Journal UUID:' $OUT)" ]; then
-       rm -f $test_name.ok
        mv $test_name.log $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
 else
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        mv $test_name.log $test_name.ok
-       rm -f $test_name.failed
 fi
 rm -f $TMPFILE
index 43afe9da16fe5b35ef9c1d235495dbc0ef151de7..8fc8158ff60d23e1d480eb42b8a9fe91701d0d29 100644 (file)
@@ -1,13 +1,12 @@
 FSCK_OPT=-yf
 
-TMPFILE=test.img
-rm -f $test_name.failed $test_name.ok
+TMPFILE=$test_name.tmp
 > $TMPFILE
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ] ; then
        rm -f $TMPFILE
-       echo "skipped for tmpfs (no O_DIRECT support)"
+       echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
        return 0
 fi
 
@@ -15,7 +14,7 @@ $MKE2FS -q -F -o Linux -b 4096 $TMPFILE 100 > $test_name.log 2>&1
 status=$?
 if [ "$status" != 0 ] ; then
        echo "mke2fs failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
@@ -23,18 +22,18 @@ $TUNE2FS -O mmp -E mmp_update_interval=1 $TMPFILE >> $test_name.log 2>&1
 status=$?
 if [ "$status" != 0 ] ; then
        echo "tune2fs -O mmp failed with $status" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
 $FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
 status=$?
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
        echo "e2fsck with MMP enabled failed with $status" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 rm -f $TMPFILE
index d9a5b3e37a64266ade3b9714b6712a91db56d2f9..1dee14ed53ccb9d3baa90541534420e593300055 100644 (file)
@@ -1,13 +1,12 @@
 FSCK_OPT=-yf
 
-TMPFILE=test.img
-rm -f $test_name.failed $test_name.ok
+TMPFILE=$test_name.tmp
 > $TMPFILE
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
        rm -f $TMPFILE
-       echo "skipped for tmpfs (no O_DIRECT support)"
+       echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
        return 0
 fi
 
@@ -15,7 +14,7 @@ $MKE2FS -q -F -o Linux -b 4096 -O mmp $TMPFILE 100 > $test_name.log 2>&1
 status=$?
 if [ "$status" != 0 ] ; then
        echo "mke2fs -O mmp failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
@@ -23,18 +22,18 @@ $TUNE2FS -O ^mmp $TMPFILE > $test_name.log 2>&1
 status=$?
 if [ "$status" != 0 ] ; then
        echo "tune2fs -O ^mmp failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 
 $FSCK $FSCK_OPT $TMPFILE > $test_name.log 2>&1
 status=$?
 if [ "$status" = 0 ] ; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
        echo "e2fsck after MMP disable failed" > $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
        return $status
 fi
 rm -f $TMPFILE
diff --git a/tests/test_one.in b/tests/test_one.in
new file mode 100644 (file)
index 0000000..238b4b7
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+# run a single regression test
+
+LC_ALL=C
+export LC_ALL
+
+case "$1" in
+    --valgrind)
+       export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
+       shift;
+       ;;
+    --valgrind-leakcheck)
+       export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log"
+       shift;
+       ;;
+esac
+
+case "$1" in
+    *.failed|*.new|*.ok|*.log|*.tmp)   exit 0 ;;
+esac
+
+test_dir=$1
+cmd_dir=$SRCDIR
+
+if test "$TEST_CONFIG"x = x; then
+       TEST_CONFIG=$SRCDIR/test_config
+fi
+
+. $TEST_CONFIG
+
+TMPFILE=$(mktemp)
+
+test_name=`echo $test_dir | sed -e 's;.*/;;'`
+if [ -f $test_dir ] ; then
+       exit 0;
+fi
+if [ ! -d $test_dir ] ; then
+       echo "The test '$test_name' does not exist."
+       exit 0;
+fi
+if [ -z "`ls $test_dir`" ]; then
+       exit 0
+fi
+if [ -f $test_dir/name ]; then
+       test_description=`cat $test_dir/name`
+else
+       test_description=
+fi
+
+rm -f $test_name.ok $test_name.failed
+#echo -e -n "$test_name: $test_description:\r"
+
+if [ -f $test_dir/script ]; then
+       . $test_dir/script
+else
+       test_base=`echo $test_name | sed -e 's/_.*//'`
+       default_script=$SRCDIR/defaults/${test_base}_script
+       if [ -f $default_script ]; then
+               . $SRCDIR/defaults/${test_base}_script
+       else
+               echo "$test_name: Missing test script $default_script!"
+       fi
+       [ -f $test_name.failed ] && cat $test_name.failed
+fi
+
+if [ "$SKIP_UNLINK" != "true" ] ; then
+       rm -f $TMPFILE
+fi
+
diff --git a/tests/test_post b/tests/test_post
new file mode 100755 (executable)
index 0000000..1251266
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# report stats about test scripts that were run
+
+num_ok=`ls *.ok 2>/dev/null | wc -l`
+num_failed=`ls *.failed 2>/dev/null | wc -l`
+
+echo "$num_ok tests succeeded  $num_failed tests failed"
+
+test "$num_failed" -eq 0 && exit 0
+
+echo -n "Tests failed: "
+for fname in $(ls *.failed); do
+       echo -n "${fname%%.failed} "
+done
+echo ""
+
+exit 1
index b7ac86e3df6081b56a4c57aa0783292dd0a10839..41ad104b93c0d5ab8cad0b834e5564add330ab79 100644 (file)
@@ -1,12 +1,8 @@
 #!/bin/sh
+# Run all or specified test scripts
 #
-# Test script for e2fsck
-#
-
-LC_ALL=C
-export LC_ALL
 
-case "$1" in 
+case "$1" in
     --valgrind)
        export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
        shift;
@@ -18,72 +14,19 @@ case "$1" in
 esac
 
 if test "$1"x = x ; then
-  TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | $EGREP -v "\.failed|\.new"`
+  TESTS=`ls -d $SRCDIR/[a-zA-Z]_*`
 else
   TESTS=
-  for i 
-  do
+  for i; do
     case $i in
-       *.failed|*.new) continue ;;
        [a-zA-Z])       TESTS="$TESTS $SRCDIR/${i}_*" ;;
        *)              TESTS="$TESTS $SRCDIR/$i" ;;
     esac
   done
 fi
 
-cmd_dir=$SRCDIR
-
-if test "$TEST_CONFIG"x = x; then
-       TEST_CONFIG=$SRCDIR/test_config
-fi
-
-. $TEST_CONFIG
-
-TMPFILE=$(mktemp)
-
-for test_dir in $TESTS
-do
-       test_name=`echo $test_dir | sed -e 's;.*/;;'`
-       if [ -f $test_dir ] ; then
-           continue;
-       fi
-       if [ ! -d $test_dir ] ; then
-               echo "The test '$test_name' does not exist."
-               continue;
-       fi
-       if [ -z "`ls $test_dir`" ]; then
-               continue
-       fi
-       if [ -f $test_dir/name ]; then
-               test_description=`cat $test_dir/name`
-               printf "%s: %s: " "$test_name" "$test_description"
-       else
-               printf "%s: " "$test_name"
-       fi
-       if [ -f $test_dir/script ]; then
-               . $test_dir/script
-       else
-               test_base=`echo $test_name | sed -e 's/_.*//'`
-               default_script=$SRCDIR/defaults/${test_base}_script
-               if [ -f $default_script ]; then
-                       . $SRCDIR/defaults/${test_base}_script
-               else
-                       echo "Missing test script!"
-               fi
-       fi
-done
-
-num_ok=`ls *.ok 2>/dev/null | wc -l`
-num_failed=`ls *.failed 2>/dev/null | wc -l`
-
-echo "$num_ok tests succeeded  $num_failed tests failed"
-
-test "$num_failed" -eq 0 && exit 0
-
-echo -n "Tests failed: "
-for fname in $(ls *.failed); do
-       echo -n "${fname%%.failed} "
+for test_dir in $TESTS; do
+       ./test_one $test_dir
 done
-echo ""
 
-exit 1
+$SRCDIR/test_post
index ef98899eddd94d5f79d1224034e1efae11d59e75..fcf5eae9023ccfa157e94750da222a3212db49ea 100644 (file)
@@ -1,4 +1,4 @@
-printf "e2undo with mke2fs: "
+test_description="e2undo with mke2fs"
 if test -x $E2UNDO_EXE; then
 
 E2FSPROGS_UNDO_DIR=/tmp
@@ -24,13 +24,11 @@ new_md5=`md5sum $TMPFILE | cut -d " " -f 1`
 echo md5sum after e2undo $new_md5 >> $OUT
 
 if [ $md5 = $new_md5 ]; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
-       rm -f $test_name.failed
 else
-       rm -f $test_name.ok
        ln -f $test_name.log $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
 fi
 rm -f $TDB_FILE $TMPFILE
 fi
index 222b95f3b0bb706aaafbf428e55b6e36856c50c3..4cc1e0c06823bc8ea4e4a7686931be616f7f941b 100644 (file)
@@ -1,4 +1,4 @@
-printf "e2undo with tune2fs: "
+test_description="e2undo with tune2fs"
 if test -x $E2UNDO_EXE; then
 
 E2FSPROGS_UNDO_DIR=/tmp
@@ -24,13 +24,11 @@ new_md5=`md5sum $TMPFILE | cut -d " " -f 1`
 echo md5sum after e2undo $new_md5 >> $OUT
 
 if [ $md5 = $new_md5 ]; then
-       echo "ok"
+       echo "$test_name: $test_description: ok"
        touch $test_name.ok
-       rm -f $test_name.failed
 else
-       rm -f $test_name.ok
        ln -f $test_name.log $test_name.failed
-       echo "failed"
+       echo "$test_name: $test_description: failed"
 fi
 rm -f $TDB_FILE $TMPFILE
 fi