summaryrefslogtreecommitdiffstats
path: root/tests/Makefile.in
blob: ba06b3b6b91f58a0ee5167c6e80cd3d949e409bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#
# Makefile for the tests directory
#

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
top_builddir = ..
my_dir = tests
INSTALL = @INSTALL@
MKDIR_P = @MKDIR_P@

@MCONFIG@

all:: @DO_TEST_SUITE@ test_one test_script

test_one: $(srcdir)/test_one.in Makefile mke2fs.conf test_data.tmp
	@echo "Creating test_one script..."
	@[ -f test_one ] && chmod u+w test_one || true
	@echo "#!/bin/sh" > test_one
	@echo "HTREE=y" >> test_one
	@echo "QUOTA=y" >> test_one
	@echo "SRCDIR=@srcdir@" >> test_one
	@echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one
	@echo "SIZEOF_TIME_T=@SIZEOF_TIME_T@" >> test_one
	@echo "DD=@DD@" >>test_one
	@cat $(srcdir)/test_one.in >> test_one
	@chmod +x-w test_one

test_script: test_one test_script.in Makefile mke2fs.conf test_data.tmp
	@echo "Creating test_script..."
	@[ -f test_script ] && chmod u+w test_script || true
	@echo "#!/bin/sh" > test_script
	@echo "SRCDIR=@srcdir@" >> test_script
	@cat $(srcdir)/test_script.in >> test_script
	@chmod +x-w test_script

mke2fs.conf: $(srcdir)/mke2fs.conf.in
	$(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf

test_data.tmp: $(srcdir)/scripts/gen-test-data
	$(srcdir)/scripts/gen-test-data > test_data.tmp

.PHONY : test_pre test_post check always_run

always_run:

@ifGNUmake@TESTS=$(wildcard $(srcdir)/[a-z]_*)
@ifNotGNUmake@TESTS != echo $(srcdir)/[a-z]_*

SKIP_SLOW_TESTS=--skip-slow-tests

$(TESTS):: test_one always_run
	@./test_one $(SKIP_SLOW_TESTS) $@

foo:
	echo $(TESTS)

test_pre:
	@$(RM) -f *.failed
	@echo "Running e2fsprogs test suite..."
	@echo " "

test_post: test_pre $(TESTS)
	@$(srcdir)/test_post

check:: test_pre test_post test_script

fullcheck::
	$(MAKE) SKIP_SLOW_TESTS= check

check-failed: $(basename $(wildcard *.failed))
	@$(srcdir)/test_post


TDIR=f_testnew
# Target which creates a new testcase to simplify adding new regression tests.
testnew:
	@echo "Creating a new e2fsck testcase in ${TDIR}"
	@mkdir -p ${TDIR}
	dd if=/dev/zero of=${TDIR}/image bs=1k count=8k
	$(top_srcdir)/misc/mke2fs -j -F -N 256 ${TDIR}/image
	@echo "new test description" > ${TDIR}/name
	@echo; echo; echo "New test filesystem at ${TDIR}/image."
	@echo "Now, break the filesystem as appropriate, and run 'make testend'"

EXPECT1=${TDIR}/expect.1
EXPECT2=${TDIR}/expect.2
# Target which generates the expect files for the new testcase.
testend: test_one ${TDIR}/image
	gzip -9 ${TDIR}/image
	@OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_one ${TDIR}
	@echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***"
	@cat ${EXPECT1}
	@echo "*** output from second e2fsck run (${EXPECT2}) ***"
	@cat ${EXPECT2}
	@echo "*** end of e2fsck output ***"
	@echo; echo "Hopefully e2fsck now fixes this problem properly."
	@echo "If all is well, edit ${TDIR}/name and rename ${TDIR}."

clean::
	$(RM) -f *~ *.log *.new *.failed *.ok *.tmp *.slow
	$(RM) -f test_one test_script mke2fs.conf test_data.tmp

distclean:: clean
	$(RM) -f Makefile
	$(RM) -rf ${TDIR}