1# This is a generated file, do NOT edit! 2# See contrib/bmake/bsd.after-import.mk 3# 4# $FreeBSD$ 5 6SRCTOP?= ${.CURDIR:H:H:H} 7 8# $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $ 9# 10# $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $ 11# 12# Unit tests for make(1) 13# The main targets are: 14# 15# all: run all the tests 16# test: run 'all', capture output and compare to expected results 17# accept: move generated output to expected results 18# 19# Adding a test case. 20# Each feature should get its own set of tests in its own suitably 21# named makefile which should be added to SUBFILES to hook it in. 22# 23 24srcdir= ${SRCTOP}/contrib/bmake/unit-tests 25 26.MAIN: all 27 28UNIT_TESTS:= ${srcdir} 29 30# Simple sub-makefiles - we run them as a black box 31# keep the list sorted. 32SUBFILES= \ 33 comment \ 34 cond1 \ 35 error \ 36 export \ 37 export-all \ 38 doterror \ 39 dotwait \ 40 forloop \ 41 forsubst \ 42 hash \ 43 misc \ 44 moderrs \ 45 modmatch \ 46 modmisc \ 47 modorder \ 48 modts \ 49 modword \ 50 phony-end \ 51 posix \ 52 qequals \ 53 sysv \ 54 ternary \ 55 unexport \ 56 unexport-env \ 57 varcmd 58 59all: ${SUBFILES} 60 61flags.doterror= 62 63# the tests are actually done with sub-makes. 64.PHONY: ${SUBFILES} 65.PRECIOUS: ${SUBFILES} 66${SUBFILES}: 67 -@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@ 68 69clean: 70 rm -f *.out *.fail *.core 71 72.sinclude <bsd.obj.mk> 73 74TEST_MAKE?= ${.MAKE} 75TOOL_SED?= sed 76TOOL_TR?= tr 77TOOL_DIFF?= diff 78DIFF_FLAGS?= -u 79 80# ensure consistent results from sort(1) 81LC_ALL= C 82LANG= C 83.export LANG LC_ALL 84 85# The driver. 86# We always pretend .MAKE was called 'make' 87# and strip ${.CURDIR}/ from the output 88# and replace anything after 'stopped in' with unit-tests 89# so the results can be compared. 90test: 91 @echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1" 92 @cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \ 93 ${TOOL_TR} -d '\015' | \ 94 ${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \ 95 -e '/stopped/s, /.*, unit-tests,' \ 96 -e 's,${.CURDIR:C/\./\\\./g}/,,g' \ 97 -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \ 98 tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; } 99 ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out 100 101accept: 102 mv test.out ${srcdir}/test.exp 103 104