OSDN Git Service

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