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