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