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