blob: 2c3ac76e6e7bbc28ec4ee5791d130cabd98cb290 [file] [log] [blame]
Theodore Ts'oa418d3a1997-04-26 14:00:26 +00001#
2# Makefile for the tests directory
3#
4
5srcdir = @srcdir@
6top_srcdir = @top_srcdir@
7VPATH = @srcdir@
8top_builddir = ..
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00009my_dir = tests
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000010INSTALL = @INSTALL@
11
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000012@MCONFIG@
13
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000014all:: @DO_TEST_SUITE@
15
Theodore Ts'o3d438362008-02-19 08:32:58 -050016test_script: test_script.in Makefile mke2fs.conf
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000017 @echo "Creating test_script..."
18 @echo "#!/bin/sh" > test_script
Theodore Ts'o8fdc9982002-06-25 23:26:34 -040019@HTREE_CMT@ @echo "HTREE=y" >> test_script
Theodore Ts'o32237012005-01-17 19:13:39 -050020 @echo 'EGREP="@EGREP@"' >> test_script
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000021 @echo "SRCDIR=@srcdir@" >> test_script
Theodore Ts'oe54635d2006-08-06 14:33:13 -040022 @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_script
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000023 @cat $(srcdir)/test_script.in >> test_script
24 @chmod +x test_script
25
Theodore Ts'o3d438362008-02-19 08:32:58 -050026mke2fs.conf: $(srcdir)/../misc/mke2fs.conf
27 sed -e 's/blocksize = -1/blocksize = 4096/' $< >mke2fs.conf
28
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000029check:: test_script
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000030 @echo "Running e2fsprogs test suite..."
31 @echo " "
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000032 @./test_script
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000033
Theodore Ts'o52325592006-11-11 09:45:50 -050034check-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
Andreas Dilgerf10ff642002-01-06 21:58:52 -070043TDIR=f_testnew
44# Target which creates a new testcase to simplify adding new regression tests.
45testnew:
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 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
54EXPECT1=${TDIR}/expect.1
55EXPECT2=${TDIR}/expect.2
56# Target which generates the expect files for the new testcase.
57testend: 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
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000068clean::
Theodore Ts'o3d438362008-02-19 08:32:58 -050069 $(RM) -f *~ *.log *.new *.failed *.ok test.img test_script mke2fs.conf
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000070
71distclean:: clean
72 $(RM) -f Makefile
Andreas Dilgerf10ff642002-01-06 21:58:52 -070073 $(RM) -rf ${TDIR}