Home | History | Annotate | Line # | Download | only in unit-tests
Makefile revision 1.1
      1 # $Id: Makefile,v 1.1 2003/07/28 22:52:12 sjg Exp $
      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.  
     11 # Each feature should get its own set of tests which should be hooked
     12 # into the 'all' target.
     13 # 
     14 
     15 .MAIN: all
     16 
     17 all: mod-ts
     18 
     19 LIST= one two three
     20 LIST+= four five six
     21 
     22 FU_mod-ts = a / b / cool
     23 
     24 mod-ts:
     25 	@echo LIST='${LIST}'
     26 	@echo LIST:ts,='${LIST:ts,}'
     27 	@echo LIST:ts/:tu='${LIST:ts/:tu}'
     28 	@echo LIST:tu:ts/='${LIST:tu:ts/}'
     29 	@echo LIST:ts:='${LIST:ts:}'
     30 	@echo LIST:ts='${LIST:ts}'
     31 	@echo LIST:ts:S/two/2/='${LIST:ts:S/two/2/}'
     32 	@echo LIST:S/two/2/:ts='${LIST:S/two/2/:ts}'
     33 	@echo LIST:ts/:S/two/2/='${LIST:ts/:S/two/2/}'
     34 	@echo "LIST:ts\n='${LIST:ts\n}'"
     35 	@echo "LIST:ts\t='${LIST:ts\t}'"
     36 	@echo "LIST:ts\012:tu='${LIST:ts\012:tu}'"
     37 	@echo "LIST:tx='${LIST:tx}'"
     38 	@echo "LIST:ts\a:tu='${LIST:ts\a:tu}'"
     39 	@echo "FU_$@='${FU_${@:ts}:ts}'"
     40 	@echo "FU_$@:ts:T='${FU_${@:ts}:ts:T}' == cool?"
     41 
     42 clean:
     43 	rm -f *.out *.fail *.core
     44 
     45 .include <bsd.obj.mk>
     46 
     47 TEST_MAKE?= ${MAKE}
     48 
     49 # here is the driver
     50 test:
     51 	@echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1"
     52 	@${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1 || { \
     53 	tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; }
     54 	diff -u ${.CURDIR}/${.TARGET}.exp ${.TARGET}.out
     55 
     56 accept:
     57 	mv test.out ${.CURDIR}/test.exp
     58 
     59