Whamcloud - gitweb
tests: fix test scripts that don't work on non-Linux systems.
[tools/e2fsprogs.git] / tests / Makefile.in
index 945b1d6..37a043e 100644 (file)
@@ -11,22 +11,47 @@ INSTALL = @INSTALL@
 
 @MCONFIG@
 
-all:: @DO_TEST_SUITE@
+all:: @DO_TEST_SUITE@ test_one test_script
 
-test_script: test_script.in Makefile
+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
+@QUOTA_CMT@    @echo "QUOTA=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
-@HTREE_CLR_CMT@        @echo "HTREE_CLR=y" >> test_script
-       @echo 'EGREP="@EGREP@"' >> test_script
        @echo "SRCDIR=@srcdir@" >> test_script
        @cat $(srcdir)/test_script.in >> test_script
        @chmod +x test_script
 
-check:: test_script
+mke2fs.conf: $(srcdir)/mke2fs.conf.in
+       $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf
+
+.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
+
+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
 # Target which creates a new testcase to simplify adding new regression tests.
@@ -34,7 +59,7 @@ testnew:
        @echo "Creating a new e2fsck testcase in ${TDIR}"
        @mkdir -p ${TDIR}
        dd if=/dev/zero of=${TDIR}/image bs=1k count=8k
-       mke2fs -j -F -N 256 ${TDIR}/image
+       $(top_srcdir)/misc/mke2fs -j -F -N 256 ${TDIR}/image
        @echo "new test description" > ${TDIR}/name
        @echo; echo; echo "New test filesystem at ${TDIR}/image."
        @echo "Now, break the filesystem as appropriate, and run 'make testend'"
@@ -42,9 +67,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}) ***"
@@ -54,7 +79,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
+       $(RM) -f *~ *.log *.new *.failed *.ok *.tmp test_one test_script mke2fs.conf
 
 distclean:: clean
        $(RM) -f Makefile