Annotation of src/usr.bin/make/unit-tests/Makefile, Revision 1.18
1.18 ! sjg 1: # $NetBSD: Makefile,v 1.17 2006/02/13 18:17:36 apb Exp $
1.1 sjg 2: #
3: # Unit tests for make(1)
4: # The main targets are:
5: #
6: # all: run all the tests
7: # test: run 'all', capture output and compare to expected results
8: # accept: move generated output to expected results
9: #
10: # Adding a test case.
1.11 sjg 11: # Each feature should get its own set of tests in its own suitably
12: # named makefile which should be added to SUBFILES to hook it in.
1.1 sjg 13: #
14:
15: .MAIN: all
16:
1.7 sjg 17: UNIT_TESTS:= ${.PARSEDIR}
18:
1.11 sjg 19: # Simple sub-makefiles - we run them as a black box
20: # keep the list sorted.
21: SUBFILES= \
1.16 rpaulo 22: comment \
1.12 sjg 23: cond1 \
1.11 sjg 24: modmatch \
1.18 ! sjg 25: modmisc \
1.15 sjg 26: modorder \
1.11 sjg 27: modts \
28: modword \
1.13 sjg 29: posix \
1.11 sjg 30: ternary \
31: varcmd
32:
33: all: ${SUBFILES}
34:
35: # the tests are actually done with sub-makes.
36: .PHONY: ${SUBFILES}
37: ${SUBFILES}:
1.13 sjg 38: -@${.MAKE} -k -f ${UNIT_TESTS}/$@
1.9 sjg 39:
1.1 sjg 40: clean:
41: rm -f *.out *.fail *.core
42:
43: .include <bsd.obj.mk>
44:
1.15 sjg 45: TEST_MAKE?= ${.MAKE}
1.1 sjg 46:
1.11 sjg 47: # The driver.
1.12 sjg 48: # We always pretend .MAKE was called 'make'
49: # and strip ${.CURDIR}/ from the output
1.13 sjg 50: # and replace anything after 'stopped in' with unit-tests
1.12 sjg 51: # so the results can be compared.
1.1 sjg 52: test:
53: @echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1"
1.6 sjg 54: @cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \
1.17 apb 55: sed -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \
1.13 sjg 56: -e '/stopped/s, /.*, unit-tests,' \
1.17 apb 57: -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
58: -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \
1.1 sjg 59: tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; }
1.7 sjg 60: diff -u ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out
1.1 sjg 61:
62: accept:
63: mv test.out ${.CURDIR}/test.exp
64:
CVSweb <webmaster@jp.NetBSD.org>