Whamcloud - gitweb
tests: use make rules to run tests in parallel
[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@ test_one test_script
15
16 test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
17         @echo "Creating test_one script..."
18         @echo "#!/bin/sh" > test_one
19 @HTREE_CMT@     @echo "HTREE=y" >> test_one
20         @echo "SRCDIR=@srcdir@" >> test_one
21         @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one
22         @cat $(srcdir)/test_one.in >> test_one
23         @chmod +x test_one
24
25 test_script: test_one test_script.in Makefile mke2fs.conf
26         @echo "Creating test_script..."
27         @echo "#!/bin/sh" > test_script
28         @echo "SRCDIR=@srcdir@" >> test_script
29         @cat $(srcdir)/test_script.in >> test_script
30         @chmod +x test_script
31
32 mke2fs.conf: $(srcdir)/mke2fs.conf.in
33         $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf
34
35 .PHONY : test_pre test_post check always_run
36
37 TESTS=$(wildcard $(srcdir)/[a-z]_*)
38 $(TESTS):: test_one always_run
39         @./test_one $@
40
41 test_pre:
42         @$(RM) -f *.failed
43         @echo "Running e2fsprogs test suite..."
44         @echo " "
45
46 test_post: test_pre $(TESTS)
47         @$(srcdir)/test_post
48
49 check:: test_pre test_post test_script
50
51 check-failed: $(basename $(wildcard *.failed))
52         @$(srcdir)/test_post
53
54
55 TDIR=f_testnew
56 # Target which creates a new testcase to simplify adding new regression tests.
57 testnew:
58         @echo "Creating a new e2fsck testcase in ${TDIR}"
59         @mkdir -p ${TDIR}
60         dd if=/dev/zero of=${TDIR}/image bs=1k count=8k
61         $(top_srcdir)/misc/mke2fs -j -F -N 256 ${TDIR}/image
62         @echo "new test description" > ${TDIR}/name
63         @echo; echo; echo "New test filesystem at ${TDIR}/image."
64         @echo "Now, break the filesystem as appropriate, and run 'make testend'"
65
66 EXPECT1=${TDIR}/expect.1
67 EXPECT2=${TDIR}/expect.2
68 # Target which generates the expect files for the new testcase.
69 testend: test_one ${TDIR}/image
70         gzip -9 ${TDIR}/image
71         @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_one ${TDIR}
72         @echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***"
73         @cat ${EXPECT1}
74         @echo "*** output from second e2fsck run (${EXPECT2}) ***"
75         @cat ${EXPECT2}
76         @echo "*** end of e2fsck output ***"
77         @echo; echo "Hopefully e2fsck now fixes this problem properly."
78         @echo "If all is well, edit ${TDIR}/name and rename ${TDIR}."
79
80 clean::
81         $(RM) -f *~ *.log *.new *.failed *.ok *.tmp test_one test_script mke2fs.conf
82
83 distclean:: clean
84         $(RM) -f Makefile
85         $(RM) -rf ${TDIR}