Whamcloud - gitweb
9dd10340157b4a9eddbac4c883c1684930211d26
[tools/e2fsprogs.git] / tests / Makefile.in
1 #
2 # Makefile for the tests directory
3 #
4
5 srcdir = @srcdir@
6 top_srcdir = @top_srcdir@
7 VPATH = @srcdir@
8 top_builddir = ..
9 my_dir = tests
10 INSTALL = @INSTALL@
11
12 @MCONFIG@
13
14 all:: @DO_TEST_SUITE@
15
16 test_script: test_script.in Makefile mke2fs.conf
17         @echo "Creating test_script..."
18         @echo "#!/bin/sh" > test_script
19 @HTREE_CMT@     @echo "HTREE=y" >> test_script
20         @echo 'EGREP="@EGREP@"' >> test_script
21         @echo "SRCDIR=@srcdir@" >> test_script
22         @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_script
23         @cat $(srcdir)/test_script.in >> test_script
24         @chmod +x test_script
25
26 mke2fs.conf: $(srcdir)/mke2fs.conf.in
27         $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf
28
29 check:: test_script
30         @echo "Running e2fsprogs test suite..."
31         @echo " "
32         @./test_script
33
34 check-failed:
35         @a=`/bin/ls *.failed 2> /dev/null | sed -e 's/.failed//'`; \
36         if test "$$a"x == x ; then \
37                 echo "No failed tests" ; \
38         else \
39                 ./test_script $$a ; \
40         fi
41
42
43 TDIR=f_testnew
44 # Target which creates a new testcase to simplify adding new regression tests.
45 testnew:
46         @echo "Creating a new e2fsck testcase in ${TDIR}"
47         @mkdir -p ${TDIR}
48         dd if=/dev/zero of=${TDIR}/image bs=1k count=8k
49         $(top_srcdir)/misc/mke2fs -j -F -N 256 ${TDIR}/image
50         @echo "new test description" > ${TDIR}/name
51         @echo; echo; echo "New test filesystem at ${TDIR}/image."
52         @echo "Now, break the filesystem as appropriate, and run 'make testend'"
53
54 EXPECT1=${TDIR}/expect.1
55 EXPECT2=${TDIR}/expect.2
56 # Target which generates the expect files for the new testcase.
57 testend: test_script ${TDIR}/image
58         gzip -9 ${TDIR}/image
59         @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_script ${TDIR}
60         @echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***"
61         @cat ${EXPECT1}
62         @echo "*** output from second e2fsck run (${EXPECT2}) ***"
63         @cat ${EXPECT2}
64         @echo "*** end of e2fsck output ***"
65         @echo; echo "Hopefully e2fsck now fixes this problem properly."
66         @echo "If all is well, edit ${TDIR}/name and rename ${TDIR}."
67
68 clean::
69         $(RM) -f *~ *.log *.new *.failed *.ok test.img test_script mke2fs.conf
70
71 distclean:: clean
72         $(RM) -f Makefile
73         $(RM) -rf ${TDIR}