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 | |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 14 | all:: @DO_TEST_SUITE@ |
| 15 | |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 16 | test_script: test_script.in Makefile |
| 17 | @echo "Creating test_script..." |
| 18 | @echo "#!/bin/sh" > test_script |
Theodore Ts'o | 8fdc998 | 2002-06-25 23:26:34 -0400 | [diff] [blame] | 19 | @HTREE_CMT@ @echo "HTREE=y" >> test_script |
Theodore Ts'o | 3223701 | 2005-01-17 19:13:39 -0500 | [diff] [blame] | 20 | @echo 'EGREP="@EGREP@"' >> test_script |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 21 | @echo "SRCDIR=@srcdir@" >> test_script |
Theodore Ts'o | e54635d | 2006-08-06 14:33:13 -0400 | [diff] [blame] | 22 | @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_script |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 23 | @cat $(srcdir)/test_script.in >> test_script |
| 24 | @chmod +x test_script |
| 25 | |
| 26 | check:: test_script |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 27 | @echo "Running e2fsprogs test suite..." |
| 28 | @echo " " |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 29 | @./test_script |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 30 | |
Theodore Ts'o | 5232559 | 2006-11-11 09:45:50 -0500 | [diff] [blame] | 31 | check-failed: |
| 32 | @a=`/bin/ls *.failed 2> /dev/null | sed -e 's/.failed//'`; \ |
| 33 | if test "$$a"x == x ; then \ |
| 34 | echo "No failed tests" ; \ |
| 35 | else \ |
| 36 | ./test_script $$a ; \ |
| 37 | fi |
| 38 | |
| 39 | |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 40 | TDIR=f_testnew |
| 41 | # Target which creates a new testcase to simplify adding new regression tests. |
| 42 | testnew: |
| 43 | @echo "Creating a new e2fsck testcase in ${TDIR}" |
| 44 | @mkdir -p ${TDIR} |
| 45 | dd if=/dev/zero of=${TDIR}/image bs=1k count=8k |
| 46 | mke2fs -j -F -N 256 ${TDIR}/image |
| 47 | @echo "new test description" > ${TDIR}/name |
| 48 | @echo; echo; echo "New test filesystem at ${TDIR}/image." |
| 49 | @echo "Now, break the filesystem as appropriate, and run 'make testend'" |
| 50 | |
| 51 | EXPECT1=${TDIR}/expect.1 |
| 52 | EXPECT2=${TDIR}/expect.2 |
| 53 | # Target which generates the expect files for the new testcase. |
| 54 | testend: test_script ${TDIR}/image |
| 55 | gzip -9 ${TDIR}/image |
| 56 | @OUT1=${EXPECT1} OUT2=${EXPECT2} ./test_script ${TDIR} |
| 57 | @echo; echo; echo "*** output from first e2fsck run (${EXPECT1}) ***" |
| 58 | @cat ${EXPECT1} |
| 59 | @echo "*** output from second e2fsck run (${EXPECT2}) ***" |
| 60 | @cat ${EXPECT2} |
| 61 | @echo "*** end of e2fsck output ***" |
| 62 | @echo; echo "Hopefully e2fsck now fixes this problem properly." |
| 63 | @echo "If all is well, edit ${TDIR}/name and rename ${TDIR}." |
| 64 | |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 65 | clean:: |
Theodore Ts'o | b7aa0d6 | 2005-02-05 15:48:49 -0500 | [diff] [blame] | 66 | $(RM) -f *~ *.log *.new *.failed *.ok test.img test_script |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 67 | |
| 68 | distclean:: clean |
| 69 | $(RM) -f Makefile |
Andreas Dilger | f10ff64 | 2002-01-06 21:58:52 -0700 | [diff] [blame] | 70 | $(RM) -rf ${TDIR} |