Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 1 | # |
| 2 | # Makefile for the tests directory |
| 3 | # |
| 4 | |
| 5 | srcdir = @srcdir@ |
| 6 | top_srcdir = @top_srcdir@ |
| 7 | VPATH = @srcdir@ |
| 8 | top_builddir = .. |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 9 | my_dir = tests |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 10 | INSTALL = @INSTALL@ |
| 11 | |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 12 | @MCONFIG@ |
| 13 | |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 14 | all:: @DO_TEST_SUITE@ test_one test_script |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 15 | |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 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 |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 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 | |
Theodore Ts'o | edc1894 | 2010-05-14 20:18:11 -0400 | [diff] [blame] | 33 | mke2fs.conf: $(srcdir)/mke2fs.conf.in |
| 34 | $(CP) $(srcdir)/mke2fs.conf.in mke2fs.conf |
Theodore Ts'o | 3d43836 | 2008-02-19 08:32:58 -0500 | [diff] [blame] | 35 | |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 36 | .PHONY : test_pre test_post check always_run |
| 37 | |
| 38 | TESTS=$(wildcard $(srcdir)/[a-z]_*) |
| 39 | $(TESTS):: test_one always_run |
| 40 | @./test_one $@ |
| 41 | |
| 42 | test_pre: |
| 43 | @$(RM) -f *.failed |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 44 | @echo "Running e2fsprogs test suite..." |
| 45 | @echo " " |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 46 | |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 47 | test_post: test_pre $(TESTS) |
| 48 | @$(srcdir)/test_post |
| 49 | |
| 50 | check:: test_pre test_post test_script |
| 51 | |
| 52 | check-failed: $(basename $(wildcard *.failed)) |
| 53 | @$(srcdir)/test_post |
Theodore Ts'o | 5232559 | 2006-11-11 09:45:50 -0500 | [diff] [blame] | 54 | |
| 55 | |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 56 | TDIR=f_testnew |
| 57 | # Target which creates a new testcase to simplify adding new regression tests. |
| 58 | testnew: |
| 59 | @echo "Creating a new e2fsck testcase in ${TDIR}" |
| 60 | @mkdir -p ${TDIR} |
| 61 | dd if=/dev/zero of=${TDIR}/image bs=1k count=8k |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 62 | $(top_srcdir)/misc/mke2fs -j -F -N 256 ${TDIR}/image |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 63 | @echo "new test description" > ${TDIR}/name |
| 64 | @echo; echo; echo "New test filesystem at ${TDIR}/image." |
| 65 | @echo "Now, break the filesystem as appropriate, and run 'make testend'" |
| 66 | |
| 67 | EXPECT1=${TDIR}/expect.1 |
| 68 | EXPECT2=${TDIR}/expect.2 |
| 69 | # Target which generates the expect files for the new testcase. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 70 | testend: test_one ${TDIR}/image |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 71 | gzip -9 ${TDIR}/image |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 72 | @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_one ${TDIR} |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 73 | @echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***" |
| 74 | @cat ${EXPECT1} |
| 75 | @echo "*** output from second e2fsck run (${EXPECT2}) ***" |
| 76 | @cat ${EXPECT2} |
| 77 | @echo "*** end of e2fsck output ***" |
| 78 | @echo; echo "Hopefully e2fsck now fixes this problem properly." |
| 79 | @echo "If all is well, edit ${TDIR}/name and rename ${TDIR}." |
| 80 | |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 81 | clean:: |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 82 | $(RM) -f *~ *.log *.new *.failed *.ok *.tmp test_one test_script mke2fs.conf |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 83 | |
| 84 | distclean:: clean |
| 85 | $(RM) -f Makefile |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 86 | $(RM) -rf ${TDIR} |