Makefile revision 249033
1241279Smarcel# This is a generated file, do NOT edit! 2241279Smarcel# See contrib/bmake/bsd.after-import.mk 3241279Smarcel# 4241279Smarcel# $FreeBSD: head/usr.bin/bmake/unit-tests/Makefile 249033 2013-04-02 21:31:11Z sjg $ 5241279Smarcel 6241279SmarcelSRCTOP?= ${.CURDIR:H:H:H} 7241279Smarcel 8249033Ssjg# $Id: Makefile.in,v 1.42 2013/03/23 02:31:13 sjg Exp $ 9241279Smarcel# 10249033Ssjg# $NetBSD: Makefile,v 1.36 2013/03/22 16:36:46 sjg Exp $ 11241279Smarcel# 12241279Smarcel# Unit tests for make(1) 13241279Smarcel# The main targets are: 14241279Smarcel# 15241279Smarcel# all: run all the tests 16241279Smarcel# test: run 'all', capture output and compare to expected results 17241279Smarcel# accept: move generated output to expected results 18241279Smarcel# 19241279Smarcel# Adding a test case. 20241279Smarcel# Each feature should get its own set of tests in its own suitably 21241279Smarcel# named makefile which should be added to SUBFILES to hook it in. 22241279Smarcel# 23241279Smarcel 24241279Smarcelsrcdir= ${SRCTOP}/contrib/bmake/unit-tests 25241279Smarcel 26241279Smarcel.MAIN: all 27241279Smarcel 28241279SmarcelUNIT_TESTS:= ${srcdir} 29241279Smarcel 30241279Smarcel# Simple sub-makefiles - we run them as a black box 31241279Smarcel# keep the list sorted. 32241279SmarcelSUBFILES= \ 33241279Smarcel comment \ 34241279Smarcel cond1 \ 35241279Smarcel error \ 36241279Smarcel export \ 37241279Smarcel export-all \ 38249033Ssjg export-env \ 39241279Smarcel doterror \ 40241279Smarcel dotwait \ 41241279Smarcel forloop \ 42241279Smarcel forsubst \ 43241279Smarcel hash \ 44241279Smarcel misc \ 45241279Smarcel moderrs \ 46241279Smarcel modmatch \ 47241279Smarcel modmisc \ 48241279Smarcel modorder \ 49241279Smarcel modts \ 50241279Smarcel modword \ 51243115Ssjg order \ 52241279Smarcel phony-end \ 53241279Smarcel posix \ 54241279Smarcel qequals \ 55241279Smarcel sysv \ 56241279Smarcel ternary \ 57241279Smarcel unexport \ 58241279Smarcel unexport-env \ 59241279Smarcel varcmd 60241279Smarcel 61241279Smarcelall: ${SUBFILES} 62241279Smarcel 63241279Smarcelflags.doterror= 64243115Ssjgflags.order=-j1 65241279Smarcel 66241279Smarcel# the tests are actually done with sub-makes. 67241279Smarcel.PHONY: ${SUBFILES} 68241279Smarcel.PRECIOUS: ${SUBFILES} 69241279Smarcel${SUBFILES}: 70241279Smarcel -@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@ 71241279Smarcel 72241279Smarcelclean: 73241279Smarcel rm -f *.out *.fail *.core 74241279Smarcel 75241279Smarcel.sinclude <bsd.obj.mk> 76241279Smarcel 77241279SmarcelTEST_MAKE?= ${.MAKE} 78241279SmarcelTOOL_SED?= sed 79241279SmarcelTOOL_TR?= tr 80241279SmarcelTOOL_DIFF?= diff 81241279SmarcelDIFF_FLAGS?= -u 82241279Smarcel 83246325Ssjg.if defined(.PARSEDIR) 84241279Smarcel# ensure consistent results from sort(1) 85241279SmarcelLC_ALL= C 86241279SmarcelLANG= C 87241279Smarcel.export LANG LC_ALL 88246325Ssjg.endif 89241279Smarcel 90241279Smarcel# The driver. 91241279Smarcel# We always pretend .MAKE was called 'make' 92241279Smarcel# and strip ${.CURDIR}/ from the output 93241279Smarcel# and replace anything after 'stopped in' with unit-tests 94241279Smarcel# so the results can be compared. 95241279Smarceltest: 96241279Smarcel @echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1" 97241279Smarcel @cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \ 98241279Smarcel ${TOOL_TR} -d '\015' | \ 99241279Smarcel ${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \ 100241279Smarcel -e '/stopped/s, /.*, unit-tests,' \ 101241279Smarcel -e 's,${.CURDIR:C/\./\\\./g}/,,g' \ 102241279Smarcel -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \ 103241279Smarcel tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; } 104241279Smarcel ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out 105241279Smarcel 106241279Smarcelaccept: 107241279Smarcel mv test.out ${srcdir}/test.exp 108241279Smarcel 109