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