2 # Makefile for the tests directory
6 top_srcdir = @top_srcdir@
14 all:: @DO_TEST_SUITE@ test_one test_script
16 test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
17 @echo "Creating test_one script..."
18 @echo "#!/bin/sh" > test_one
19 @echo "HTREE=y" >> test_one
20 @echo "QUOTA=y" >> test_one
21 @echo "SRCDIR=@srcdir@" >> test_one
22 @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one
23 @echo "SIZEOF_TIME_T=@SIZEOF_TIME_T@" >> test_one
24 @cat $(srcdir)/test_one.in >> test_one
27 test_script: test_one test_script.in Makefile mke2fs.conf
28 @echo "Creating test_script..."
29 @echo "#!/bin/sh" > test_script
30 @echo "SRCDIR=@srcdir@" >> test_script
31 @cat $(srcdir)/test_script.in >> test_script
34 mke2fs.conf: $(srcdir)/mke2fs.conf.in
35 $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf
37 .PHONY : test_pre test_post check always_run
41 @ifGNUmake@TESTS=$(wildcard $(srcdir)/[a-z]_*)
42 @ifNotGNUmake@TESTS != echo $(srcdir)/[a-z]_*
44 $(TESTS):: test_one always_run
52 @echo "Running e2fsprogs test suite..."
55 test_post: test_pre $(TESTS)
58 check:: test_pre test_post test_script
60 check-failed: $(basename $(wildcard *.failed))
65 # Target which creates a new testcase to simplify adding new regression tests.
67 @echo "Creating a new e2fsck testcase in ${TDIR}"
69 dd if=/dev/zero of=${TDIR}/image bs=1k count=8k
70 $(top_srcdir)/misc/mke2fs -j -F -N 256 ${TDIR}/image
71 @echo "new test description" > ${TDIR}/name
72 @echo; echo; echo "New test filesystem at ${TDIR}/image."
73 @echo "Now, break the filesystem as appropriate, and run 'make testend'"
75 EXPECT1=${TDIR}/expect.1
76 EXPECT2=${TDIR}/expect.2
77 # Target which generates the expect files for the new testcase.
78 testend: test_one ${TDIR}/image
80 @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_one ${TDIR}
81 @echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***"
83 @echo "*** output from second e2fsck run (${EXPECT2}) ***"
85 @echo "*** end of e2fsck output ***"
86 @echo; echo "Hopefully e2fsck now fixes this problem properly."
87 @echo "If all is well, edit ${TDIR}/name and rename ${TDIR}."
90 $(RM) -f *~ *.log *.new *.failed *.ok *.tmp test_one test_script mke2fs.conf