diff options
| author | apb <apb@NetBSD.org> | 2014-08-21 13:44:51 +0000 |
|---|---|---|
| committer | apb <apb@NetBSD.org> | 2014-08-21 13:44:51 +0000 |
| commit | e0e29fb9b1efba6df79dd53a6089feb13bd02da7 (patch) | |
| tree | 94572ccf65b7976abf4579f055e0e9bc9643dd1d /usr.bin/make | |
| parent | b6020910a92470d3ef334170d1605556bc498286 (diff) | |
Give each group of tests its own output file.
* Rename each sub-makefile to *.mk;
* Add a *.exp file of expected output for each sub-makefile;
* Remove test.exp, which is replaced by all the other *.exp files.
* Use suffix rules to generate *.rawout and *.out files for
each test case.
* Rewrite the test and accept targets to adapt to the new way.
The old (now removed) test.exp file is almost identical to the
concatenation (in the correct order) of all the new *.exp files. There
are expected differences in makefile names embedded in the output, and
the new "exit status" lines. Some old "*** Error code 1 (ignored)"
lines are also removed (replaced by new "exit status 1" lines).
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/unit-tests/Makefile | 78 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/comment.exp | 5 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/comment.mk (renamed from usr.bin/make/unit-tests/comment) | 0 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/cond1.exp | 23 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/cond1.mk (renamed from usr.bin/make/unit-tests/cond1) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/doterror.exp | 9 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/doterror.mk (renamed from usr.bin/make/unit-tests/doterror) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/dotwait.exp | 30 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/dotwait.mk (renamed from usr.bin/make/unit-tests/dotwait) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/error.exp | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/error.mk (renamed from usr.bin/make/unit-tests/error) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/export-all.exp | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/export-all.mk (renamed from usr.bin/make/unit-tests/export-all) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/export-env.exp | 9 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/export-env.mk (renamed from usr.bin/make/unit-tests/export-env) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/export.exp | 6 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/export.mk (renamed from usr.bin/make/unit-tests/export) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/forloop.exp | 19 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/forloop.mk (renamed from usr.bin/make/unit-tests/forloop) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/forsubst.exp | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/forsubst.mk (renamed from usr.bin/make/unit-tests/forsubst) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/hash.exp | 9 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/hash.mk (renamed from usr.bin/make/unit-tests/hash) | 0 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/misc.exp | 1 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/misc.mk (renamed from usr.bin/make/unit-tests/misc) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/moderrs.exp | 16 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/moderrs.mk (renamed from usr.bin/make/unit-tests/moderrs) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modmatch.exp | 17 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modmatch.mk (renamed from usr.bin/make/unit-tests/modmatch) | 0 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modmisc.exp | 10 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modmisc.mk (renamed from usr.bin/make/unit-tests/modmisc) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modorder.exp | 11 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modorder.mk (renamed from usr.bin/make/unit-tests/modorder) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modts.exp | 33 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modts.mk (renamed from usr.bin/make/unit-tests/modts) | 0 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modword.exp | 122 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/modword.mk (renamed from usr.bin/make/unit-tests/modword) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/order.exp | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/order.mk (renamed from usr.bin/make/unit-tests/order) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/phony-end.exp | 6 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/phony-end.mk (renamed from usr.bin/make/unit-tests/phony-end) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/posix.exp | 23 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/posix.mk (renamed from usr.bin/make/unit-tests/posix) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/qequals.exp | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/qequals.mk (renamed from usr.bin/make/unit-tests/qequals) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/sunshcmd.exp | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/sunshcmd.mk (renamed from usr.bin/make/unit-tests/sunshcmd) | 0 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/sysv.exp | 7 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/sysv.mk (renamed from usr.bin/make/unit-tests/sysv) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/ternary.exp | 10 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/ternary.mk (renamed from usr.bin/make/unit-tests/ternary) | 0 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/test.exp | 394 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/unexport-env.exp | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/unexport-env.mk (renamed from usr.bin/make/unit-tests/unexport-env) | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/unexport.exp | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/unexport.mk (renamed from usr.bin/make/unit-tests/unexport) | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/varcmd.exp | 9 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/varcmd.mk (renamed from usr.bin/make/unit-tests/varcmd) | 2 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/varshell.exp | 12 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/varshell.mk (renamed from usr.bin/make/unit-tests/varshell) | 2 |
60 files changed, 488 insertions, 447 deletions
diff --git a/usr.bin/make/unit-tests/Makefile b/usr.bin/make/unit-tests/Makefile index d78e1c840cf..cf0b464fd8f 100644 --- a/usr.bin/make/unit-tests/Makefile +++ b/usr.bin/make/unit-tests/Makefile @@ -1,24 +1,25 @@ -# $NetBSD: Makefile,v 1.41 2014/08/21 13:31:52 apb Exp $ +# $NetBSD: Makefile,v 1.42 2014/08/21 13:44:51 apb Exp $ # # Unit tests for make(1) # The main targets are: # # all: run all the tests -# test: run 'all', capture output and compare to expected results +# test: run 'all', and compare to expected results # accept: move generated output to expected results # # Adding a test case. # Each feature should get its own set of tests in its own suitably -# named makefile which should be added to SUBFILES to hook it in. +# named makefile (*.mk), with its own set of expected results (*.exp), +# and it should be added to the TESTNAMES list. # .MAIN: all UNIT_TESTS:= ${.PARSEDIR} -# Simple sub-makefiles - we run them as a black box -# keep the list sorted. -SUBFILES= \ +# Each test is in a sub-makefile. +# Keep the list sorted. +TESTNAMES= \ comment \ cond1 \ error \ @@ -49,21 +50,16 @@ SUBFILES= \ varcmd \ varshell -all: ${SUBFILES} - +# Override make flags for certain tests flags.doterror= flags.order=-j1 -# the tests are actually done with sub-makes. -.PHONY: ${SUBFILES} -.PRECIOUS: ${SUBFILES} -${SUBFILES}: - -@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@ +OUTFILES= ${TESTNAMES:S/$/.out/} -clean: - rm -f *.out *.fail *.core +all: ${OUTFILES} -.-include <bsd.obj.mk> +clean: + rm -f *.rawout *.out *.status *.tmp *.core *.tmp TEST_MAKE?= ${.MAKE} TOOL_SED?= sed @@ -73,22 +69,48 @@ LC_ALL= C LANG= C .export LANG LC_ALL -# The driver. +# the tests are actually done with sub-makes. +.SUFFIXES: .mk .rawout .out +.mk.rawout: + @echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} + -@cd ${.OBJDIR} && \ + { ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \ + 2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp + @mv ${.TARGET}.tmp ${.TARGET} + # We always pretend .MAKE was called 'make' # and strip ${.CURDIR}/ from the output # and replace anything after 'stopped in' with unit-tests # so the results can be compared. -test: - @echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1" - cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \ - ${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \ - -e 's,${TEST_MAKE:C/\./\\\./g},make,' \ - -e '/stopped/s, /.*, unit-tests,' \ - -e 's,${.CURDIR:C/\./\\\./g}/,,g' \ - -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \ - tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; } - diff -u ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out +.rawout.out: + @echo postprocess ${.TARGET} + @${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \ + -e 's,${TEST_MAKE:C/\./\\\./g},make,' \ + -e '/stopped/s, /.*, unit-tests,' \ + -e 's,${.CURDIR:C/\./\\\./g}/,,g' \ + -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' \ + < ${.IMPSRC} > ${.TARGET}.tmp + @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp + @mv ${.TARGET}.tmp ${.TARGET} + +# Compare all output files +test: ${OUTFILES} .PHONY + @failed= ; \ + for test in ${TESTNAMES}; do \ + diff -u ${UNIT_TESTS}/$${test}.exp $${test}.out \ + || failed="$${failed}$${failed:+ }$${test}" ; \ + done ; \ + if [ -n "$${failed}" ]; then \ + echo "Failed tests: $${failed}" ; false ; \ + else \ + echo "All tests passed" ; \ + fi accept: - mv test.out ${.CURDIR}/test.exp + @for test in ${TESTNAMES}; do \ + cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \ + || { echo "Replacing $${test}.exp" ; \ + cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \ + done +.-include <bsd.obj.mk> diff --git a/usr.bin/make/unit-tests/comment.exp b/usr.bin/make/unit-tests/comment.exp new file mode 100644 index 00000000000..9a97df0b732 --- /dev/null +++ b/usr.bin/make/unit-tests/comment.exp @@ -0,0 +1,5 @@ +comment testing start +this is foo +This is how a comment looks: # comment +comment testing done +exit status 0 diff --git a/usr.bin/make/unit-tests/comment b/usr.bin/make/unit-tests/comment.mk index 7dd7dbbe28b..7dd7dbbe28b 100644 --- a/usr.bin/make/unit-tests/comment +++ b/usr.bin/make/unit-tests/comment.mk diff --git a/usr.bin/make/unit-tests/cond1.exp b/usr.bin/make/unit-tests/cond1.exp new file mode 100644 index 00000000000..701d504fcc6 --- /dev/null +++ b/usr.bin/make/unit-tests/cond1.exp @@ -0,0 +1,23 @@ +make: "cond1.mk" line 75: warning: extra else +make: "cond1.mk" line 85: warning: extra else +2 is prime +A='other' B='unknown' C='clever' o='no,no' +Passed: + var + ("var") + (var != var) + var != var + !((var != var) && defined(name)) + var == quoted + +1 is not prime +2 is prime +3 is prime +4 is not prime +5 is prime + +make: warning: String comparison operator should be either == or != +make: Bad conditional expression `"0" > 0' in "0" > 0?OK:No + +OK +exit status 0 diff --git a/usr.bin/make/unit-tests/cond1 b/usr.bin/make/unit-tests/cond1.mk index 7d3df40dc31..e3618327efe 100644 --- a/usr.bin/make/unit-tests/cond1 +++ b/usr.bin/make/unit-tests/cond1.mk @@ -1,4 +1,4 @@ -# $Id: cond1,v 1.5 2011/03/06 00:02:14 sjg Exp $ +# $Id: cond1.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ # hard code these! TEST_UNAME_S= NetBSD diff --git a/usr.bin/make/unit-tests/doterror.exp b/usr.bin/make/unit-tests/doterror.exp new file mode 100644 index 00000000000..0447a519344 --- /dev/null +++ b/usr.bin/make/unit-tests/doterror.exp @@ -0,0 +1,9 @@ +At first, I am +happy +and now: sad +.ERROR: Looks like 'sad' is upset. +*** Error code 1 + +Stop. +make: stopped in unit-tests +exit status 1 diff --git a/usr.bin/make/unit-tests/doterror b/usr.bin/make/unit-tests/doterror.mk index ec63321c83f..7f1c78ff595 100644 --- a/usr.bin/make/unit-tests/doterror +++ b/usr.bin/make/unit-tests/doterror.mk @@ -1,4 +1,4 @@ -# $Id: doterror,v 1.1 2010/04/08 17:41:29 sjg Exp $ +# $Id: doterror.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ .BEGIN: diff --git a/usr.bin/make/unit-tests/dotwait.exp b/usr.bin/make/unit-tests/dotwait.exp new file mode 100644 index 00000000000..6bf96e301c1 --- /dev/null +++ b/usr.bin/make/unit-tests/dotwait.exp @@ -0,0 +1,30 @@ +simple.1 +simple.1 +simple.2 +simple.2 +recursive.1.1.* +recursive.1.1.* +recursive.1.1.* +recursive.1.1.* +recursive.1.99 +recursive.1.99 +recursive.2.1.* +recursive.2.1.* +recursive.2.1.* +recursive.2.1.* +recursive.2.99 +recursive.2.99 +shared.0 +shared.0 +shared.1.99 +shared.1.99 +shared.2.1 +shared.2.1 +shared.2.99 +shared.2.99 +make: Graph cycles through `cycle.2.99' +make: Graph cycles through `cycle.2.98' +make: Graph cycles through `cycle.2.97' +cycle.1.99 +cycle.1.99 +exit status 0 diff --git a/usr.bin/make/unit-tests/dotwait b/usr.bin/make/unit-tests/dotwait.mk index 43706afe64b..9bdaaba399d 100644 --- a/usr.bin/make/unit-tests/dotwait +++ b/usr.bin/make/unit-tests/dotwait.mk @@ -1,4 +1,4 @@ -# $NetBSD: dotwait,v 1.1 2006/02/26 22:45:46 apb Exp $ +# $NetBSD: dotwait.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ THISMAKEFILE:= ${.PARSEDIR}/${.PARSEFILE} diff --git a/usr.bin/make/unit-tests/error.exp b/usr.bin/make/unit-tests/error.exp new file mode 100644 index 00000000000..a2bf71b7127 --- /dev/null +++ b/usr.bin/make/unit-tests/error.exp @@ -0,0 +1,4 @@ +make: "error.mk" line 3: just FYI +make: "error.mk" line 4: warning: this could be serious +make: "error.mk" line 5: this is fatal +exit status 1 diff --git a/usr.bin/make/unit-tests/error b/usr.bin/make/unit-tests/error.mk index 05c3d86ff32..721ed5052bf 100644 --- a/usr.bin/make/unit-tests/error +++ b/usr.bin/make/unit-tests/error.mk @@ -1,4 +1,4 @@ -# $Id: error,v 1.2 2010/05/24 21:04:49 sjg Exp $ +# $Id: error.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ .info just FYI .warning this could be serious diff --git a/usr.bin/make/unit-tests/export-all.exp b/usr.bin/make/unit-tests/export-all.exp new file mode 100644 index 00000000000..f7c9aa59313 --- /dev/null +++ b/usr.bin/make/unit-tests/export-all.exp @@ -0,0 +1,4 @@ +make: "export-all.mk" line 20: Could not find export +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 diff --git a/usr.bin/make/unit-tests/export-all b/usr.bin/make/unit-tests/export-all.mk index d1c79e2d341..050e638dd82 100644 --- a/usr.bin/make/unit-tests/export-all +++ b/usr.bin/make/unit-tests/export-all.mk @@ -1,4 +1,4 @@ -# $Id: export-all,v 1.2 2010/04/21 04:25:28 sjg Exp $ +# $Id: export-all.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ UT_OK=good UT_F=fine diff --git a/usr.bin/make/unit-tests/export-env.exp b/usr.bin/make/unit-tests/export-env.exp new file mode 100644 index 00000000000..6221232a2a1 --- /dev/null +++ b/usr.bin/make/unit-tests/export-env.exp @@ -0,0 +1,9 @@ +make: +UT_TEST=export-env.mk +UT_ENV=not-exported +UT_EXP=not-exported +env: +UT_TEST=export-env.mk +UT_ENV=exported +UT_EXP=exported +exit status 0 diff --git a/usr.bin/make/unit-tests/export-env b/usr.bin/make/unit-tests/export-env.mk index a6cada7e449..6e9993b7bde 100644 --- a/usr.bin/make/unit-tests/export-env +++ b/usr.bin/make/unit-tests/export-env.mk @@ -1,4 +1,4 @@ -# $Id: export-env,v 1.1 2013/03/22 16:36:46 sjg Exp $ +# $Id: export-env.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ # our normal .export, subsequent changes affect the environment UT_TEST=this diff --git a/usr.bin/make/unit-tests/export.exp b/usr.bin/make/unit-tests/export.exp new file mode 100644 index 00000000000..143771ce90a --- /dev/null +++ b/usr.bin/make/unit-tests/export.exp @@ -0,0 +1,6 @@ +UT_DOLLAR=This is $UT_FU +UT_FOO=foobar is fubar +UT_FU=fubar +UT_TEST=export +UT_ZOO=hoopie +exit status 0 diff --git a/usr.bin/make/unit-tests/export b/usr.bin/make/unit-tests/export.mk index eb4d32f7d6a..1b4ee722ca2 100644 --- a/usr.bin/make/unit-tests/export +++ b/usr.bin/make/unit-tests/export.mk @@ -1,4 +1,4 @@ -# $Id: export,v 1.1 2007/10/05 15:27:46 sjg Exp $ +# $Id: export.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ UT_TEST=export UT_FOO=foo${BAR} diff --git a/usr.bin/make/unit-tests/forloop.exp b/usr.bin/make/unit-tests/forloop.exp new file mode 100644 index 00000000000..df14b751224 --- /dev/null +++ b/usr.bin/make/unit-tests/forloop.exp @@ -0,0 +1,19 @@ +x=one +x="two and three" +x=four +x="five" +x=-I/this +x=-I"This or that" +x=-Ithat +x="-DTHIS=\"this and that\"" +cfl=-I/this -I"This or that" -Ithat "-DTHIS=\"this and that\"" +a=one b="two and three" +a=four b="five" +a=ONE b="TWO AND THREE" +a=FOUR b="FIVE" +We expect an error next: +make: "forloop.mk" line 38: Wrong number of words (9) in .for substitution list with 2 vars +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +OK +exit status 0 diff --git a/usr.bin/make/unit-tests/forloop b/usr.bin/make/unit-tests/forloop.mk index 76e98f893a1..e0399f355df 100644 --- a/usr.bin/make/unit-tests/forloop +++ b/usr.bin/make/unit-tests/forloop.mk @@ -1,4 +1,4 @@ -# $Id: forloop,v 1.1 2012/06/19 23:25:53 sjg Exp $ +# $Id: forloop.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ all: for-loop diff --git a/usr.bin/make/unit-tests/forsubst.exp b/usr.bin/make/unit-tests/forsubst.exp new file mode 100644 index 00000000000..0a98c00aff3 --- /dev/null +++ b/usr.bin/make/unit-tests/forsubst.exp @@ -0,0 +1,2 @@ +.for with :S;... OK +exit status 0 diff --git a/usr.bin/make/unit-tests/forsubst b/usr.bin/make/unit-tests/forsubst.mk index 981fb88bc4c..00cd9b634a2 100644 --- a/usr.bin/make/unit-tests/forsubst +++ b/usr.bin/make/unit-tests/forsubst.mk @@ -1,4 +1,4 @@ -# $Id: forsubst,v 1.1 2009/10/07 16:40:30 sjg Exp $ +# $Id: forsubst.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ all: for-subst diff --git a/usr.bin/make/unit-tests/hash.exp b/usr.bin/make/unit-tests/hash.exp new file mode 100644 index 00000000000..0a2423436e7 --- /dev/null +++ b/usr.bin/make/unit-tests/hash.exp @@ -0,0 +1,9 @@ +b2af338b +3360ac65 +7747f046 +9ca87054 +880fe816 +208fcbd3 +d5d376eb +de41416c +exit status 0 diff --git a/usr.bin/make/unit-tests/hash b/usr.bin/make/unit-tests/hash.mk index 1ed84e776d0..1ed84e776d0 100644 --- a/usr.bin/make/unit-tests/hash +++ b/usr.bin/make/unit-tests/hash.mk diff --git a/usr.bin/make/unit-tests/misc.exp b/usr.bin/make/unit-tests/misc.exp new file mode 100644 index 00000000000..39a9383953d --- /dev/null +++ b/usr.bin/make/unit-tests/misc.exp @@ -0,0 +1 @@ +exit status 0 diff --git a/usr.bin/make/unit-tests/misc b/usr.bin/make/unit-tests/misc.mk index bb54df488f1..2773e304bd4 100644 --- a/usr.bin/make/unit-tests/misc +++ b/usr.bin/make/unit-tests/misc.mk @@ -1,4 +1,4 @@ -# $Id: misc,v 1.1 2011/03/06 00:02:14 sjg Exp $ +# $Id: misc.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ .if !exists(${.CURDIR}/) .warning ${.CURDIR}/ doesn't exist ? diff --git a/usr.bin/make/unit-tests/moderrs.exp b/usr.bin/make/unit-tests/moderrs.exp new file mode 100644 index 00000000000..cb51aa09d90 --- /dev/null +++ b/usr.bin/make/unit-tests/moderrs.exp @@ -0,0 +1,16 @@ +Expect: Unknown modifier 'Z' +make: Unknown modifier 'Z' +VAR:Z= +Expect: Unknown modifier 'Z' +make: Unknown modifier 'Z' +VAR:Z= +Expect: Unclosed variable specification for VAR +make: Unclosed variable specification (expecting '}') for "VAR" (value "Thevariable") modifier S +VAR:S,V,v,=Thevariable +Expect: Unclosed variable specification for VAR +make: Unclosed variable specification after complex modifier (expecting '}') for VAR +VAR:S,V,v,=Thevariable +Expect: Unclosed substitution for VAR (, missing) +make: Unclosed substitution for VAR (, missing) +VAR:S,V,v= +exit status 0 diff --git a/usr.bin/make/unit-tests/moderrs b/usr.bin/make/unit-tests/moderrs.mk index 9c69810055d..825e6c719c4 100644 --- a/usr.bin/make/unit-tests/moderrs +++ b/usr.bin/make/unit-tests/moderrs.mk @@ -1,4 +1,4 @@ -# $Id: moderrs,v 1.2 2006/05/11 18:48:33 sjg Exp $ +# $Id: moderrs.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ # # various modifier error tests diff --git a/usr.bin/make/unit-tests/modmatch.exp b/usr.bin/make/unit-tests/modmatch.exp new file mode 100644 index 00000000000..fcaf6c02ed6 --- /dev/null +++ b/usr.bin/make/unit-tests/modmatch.exp @@ -0,0 +1,17 @@ +LIB=a X_LIBS:M${LIB${LIB:tu}} is "/tmp/liba.a" +LIB=a X_LIBS:M*/lib${LIB}.a is "/tmp/liba.a" +LIB=a X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBA.A" +LIB=b X_LIBS:M${LIB${LIB:tu}} is "" +LIB=b X_LIBS:M*/lib${LIB}.a is "" +LIB=b X_LIBS:M*/lib${LIB}.a:tu is "" +LIB=c X_LIBS:M${LIB${LIB:tu}} is "" +LIB=c X_LIBS:M*/lib${LIB}.a is "" +LIB=c X_LIBS:M*/lib${LIB}.a:tu is "" +LIB=d X_LIBS:M${LIB${LIB:tu}} is "/tmp/libd.a" +LIB=d X_LIBS:M*/lib${LIB}.a is "/tmp/libd.a" +LIB=d X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBD.A" +LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/libe.a" +LIB=e X_LIBS:M*/lib${LIB}.a is "/tmp/libe.a" +LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A" +Mscanner=OK +exit status 0 diff --git a/usr.bin/make/unit-tests/modmatch b/usr.bin/make/unit-tests/modmatch.mk index 48a1befb58b..48a1befb58b 100644 --- a/usr.bin/make/unit-tests/modmatch +++ b/usr.bin/make/unit-tests/modmatch.mk diff --git a/usr.bin/make/unit-tests/modmisc.exp b/usr.bin/make/unit-tests/modmisc.exp new file mode 100644 index 00000000000..e406647bc41 --- /dev/null +++ b/usr.bin/make/unit-tests/modmisc.exp @@ -0,0 +1,10 @@ +path=':/bin:/tmp::/:.:/no/such/dir:.' +path='/bin:/tmp:/:/no/such/dir' +path='/bin:/tmp:/:/no/such/dir' +path='/bin':'/tmp':'/':'/no/such/dir' +path='/bin':'/tmp':'/':'/no/such/dir' +path_/usr/xbin=/opt/xbin/ +paths=/bin /tmp / /no/such/dir /opt/xbin +PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN +The answer is 42 +exit status 0 diff --git a/usr.bin/make/unit-tests/modmisc b/usr.bin/make/unit-tests/modmisc.mk index bb537558786..a292b966557 100644 --- a/usr.bin/make/unit-tests/modmisc +++ b/usr.bin/make/unit-tests/modmisc.mk @@ -1,4 +1,4 @@ -# $Id: modmisc,v 1.7 2011/04/11 15:10:15 sjg Exp $ +# $Id: modmisc.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ # # miscellaneous modifier tests diff --git a/usr.bin/make/unit-tests/modorder.exp b/usr.bin/make/unit-tests/modorder.exp new file mode 100644 index 00000000000..411742738d6 --- /dev/null +++ b/usr.bin/make/unit-tests/modorder.exp @@ -0,0 +1,11 @@ +LIST = one two three four five six seven eight nine ten +LIST:O = eight five four nine one seven six ten three two +LIST:Ox = Ok +LIST:O:Ox = Ok +LISTX = Ok +LISTSX = Ok +make: Bad modifier `:OX' for LIST +BADMOD 1 = } +make: Bad modifier `:OxXX' for LIST +BADMOD 2 = XX} +exit status 0 diff --git a/usr.bin/make/unit-tests/modorder b/usr.bin/make/unit-tests/modorder.mk index 68b66fb6226..bc24d339f45 100644 --- a/usr.bin/make/unit-tests/modorder +++ b/usr.bin/make/unit-tests/modorder.mk @@ -1,4 +1,4 @@ -# $NetBSD: modorder,v 1.2 2007/10/05 15:27:46 sjg Exp $ +# $NetBSD: modorder.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ LIST= one two three four five six seven eight nine ten LISTX= ${LIST:Ox} diff --git a/usr.bin/make/unit-tests/modts.exp b/usr.bin/make/unit-tests/modts.exp new file mode 100644 index 00000000000..cf3c91d43c0 --- /dev/null +++ b/usr.bin/make/unit-tests/modts.exp @@ -0,0 +1,33 @@ +LIST="one two three four five six" +LIST:ts,="one,two,three,four,five,six" +LIST:ts/:tu="ONE/TWO/THREE/FOUR/FIVE/SIX" +LIST:ts::tu="ONE:TWO:THREE:FOUR:FIVE:SIX" +LIST:ts:tu="ONETWOTHREEFOURFIVESIX" +LIST:tu:ts/="ONE/TWO/THREE/FOUR/FIVE/SIX" +LIST:ts:="one:two:three:four:five:six" +LIST:ts="onetwothreefourfivesix" +LIST:ts:S/two/2/="one2threefourfivesix" +LIST:S/two/2/:ts="one2threefourfivesix" +LIST:ts/:S/two/2/="one/2/three/four/five/six" +Pretend the '/' in '/n' etc. below are back-slashes. +LIST:ts/n="one +two +three +four +five +six" +LIST:ts/t="one two three four five six" +LIST:ts/012:tu="ONE +TWO +THREE +FOUR +FIVE +SIX" +make: Bad modifier `:tx' for LIST +LIST:tx="}" +make: Bad modifier `:ts\x' for LIST +LIST:ts/x:tu="\x:tu}" +FU_mod-ts="a/b/cool" +FU_mod-ts:ts:T="cool" == cool? +B.${AAA:ts}="Baaa" == Baaa? +exit status 0 diff --git a/usr.bin/make/unit-tests/modts b/usr.bin/make/unit-tests/modts.mk index 616bd8944f2..616bd8944f2 100644 --- a/usr.bin/make/unit-tests/modts +++ b/usr.bin/make/unit-tests/modts.mk diff --git a/usr.bin/make/unit-tests/modword.exp b/usr.bin/make/unit-tests/modword.exp new file mode 100644 index 00000000000..258d7eadd6c --- /dev/null +++ b/usr.bin/make/unit-tests/modword.exp @@ -0,0 +1,122 @@ +make: Bad modifier `:[]' for LIST +LIST:[]="" is an error +LIST:[0]="one two three four five six" +LIST:[0x0]="one two three four five six" +LIST:[000]="one two three four five six" +LIST:[*]="one two three four five six" +LIST:[@]="one two three four five six" +LIST:[0]:C/ /,/="one,two three four five six" +LIST:[0]:C/ /,/g="one,two,three,four,five,six" +LIST:[0]:C/ /,/1g="one,two,three,four,five,six" +LIST:[*]:C/ /,/="one,two three four five six" +LIST:[*]:C/ /,/g="one,two,three,four,five,six" +LIST:[*]:C/ /,/1g="one,two,three,four,five,six" +LIST:[@]:C/ /,/="one two three four five six" +LIST:[@]:C/ /,/g="one two three four five six" +LIST:[@]:C/ /,/1g="one two three four five six" +LIST:[@]:[0]:C/ /,/="one,two three four five six" +LIST:[0]:[@]:C/ /,/="one two three four five six" +LIST:[@]:[*]:C/ /,/="one,two three four five six" +LIST:[*]:[@]:C/ /,/="one two three four five six" +EMPTY="" +EMPTY:[#]="1" == 1 ? +ESCAPEDSPACE="\ " +ESCAPEDSPACE:[#]="1" == 1 ? +REALLYSPACE=" " +REALLYSPACE:[#]="1" == 1 ? +LIST:[#]="6" +LIST:[0]:[#]="1" == 1 ? +LIST:[*]:[#]="1" == 1 ? +LIST:[@]:[#]="6" +LIST:[1]:[#]="1" +LIST:[1..3]:[#]="3" +EMPTY:[1]="" +ESCAPEDSPACE="\ " +ESCAPEDSPACE:[1]="\ " +REALLYSPACE=" " +REALLYSPACE:[1]="" == "" ? +REALLYSPACE:[*]:[1]=" " == " " ? +LIST:[1]="one" +make: Bad modifier `:[1.]' for LIST +LIST:[1.]="" is an error +make: Bad modifier `:[1].' for LIST +LIST:[1].="}" is an error +LIST:[2]="two" +LIST:[6]="six" +LIST:[7]="" +LIST:[999]="" +make: Bad modifier `:[-]' for LIST +LIST:[-]="" is an error +make: Bad modifier `:[--]' for LIST +LIST:[--]="" is an error +LIST:[-1]="six" +LIST:[-2]="five" +LIST:[-6]="one" +LIST:[-7]="" +LIST:[-999]="" +LONGLIST:[17]="17" +LONGLIST:[0x11]="17" +LONGLIST:[021]="17" +LIST:[0]:[1]="one two three four five six" +LIST:[*]:[1]="one two three four five six" +LIST:[@]:[1]="one" +LIST:[0]:[2]="" +LIST:[*]:[2]="" +LIST:[@]:[2]="two" +LIST:[*]:C/ /,/:[2]="" +LIST:[*]:C/ /,/:[*]:[2]="" +LIST:[*]:C/ /,/:[@]:[2]="three" +make: Bad modifier `:[1.]' for LIST +LIST:[1.]="" is an error +make: Bad modifier `:[1..]' for LIST +LIST:[1..]="" is an error +LIST:[1..1]="one" +make: Bad modifier `:[1..1.]' for LIST +LIST:[1..1.]="" is an error +LIST:[1..2]="one two" +LIST:[2..1]="two one" +LIST:[3..-2]="three four five" +LIST:[-4..4]="three four" +make: Bad modifier `:[0..1]' for LIST +LIST:[0..1]="" is an error +make: Bad modifier `:[-1..0]' for LIST +LIST:[-1..0]="" is an error +LIST:[-1..1]="six five four three two one" +LIST:[0..0]="one two three four five six" +LIST:[3..99]="three four five six" +LIST:[-3..-99]="four three two one" +LIST:[-99..-3]="one two three four" +HASH="#" == "#" ? +LIST:[${HASH}]="6" +LIST:[${ZERO}]="one two three four five six" +LIST:[${ZERO}x${ONE}]="one" +LIST:[${ONE}]="one" +LIST:[${MINUSONE}]="six" +LIST:[${STAR}]="one two three four five six" +LIST:[${AT}]="one two three four five six" +make: Bad modifier `:[${EMPTY' for LIST +LIST:[${EMPTY}]="" is an error +LIST:[${LONGLIST:[21]:S/2//}]="one" +LIST:[${LIST:[#]}]="six" +LIST:[${LIST:[${HASH}]}]="six" +LIST:S/ /,/="one two three four five six" +LIST:S/ /,/W="one,two three four five six" +LIST:S/ /,/gW="one,two,three,four,five,six" +EMPTY:S/^/,/="," +EMPTY:S/^/,/W="," +LIST:C/ /,/="one two three four five six" +LIST:C/ /,/W="one,two three four five six" +LIST:C/ /,/gW="one,two,three,four,five,six" +EMPTY:C/^/,/="," +EMPTY:C/^/,/W="," +LIST:tW="one two three four five six" +LIST:tw="one two three four five six" +LIST:tW:C/ /,/="one,two three four five six" +LIST:tW:C/ /,/g="one,two,three,four,five,six" +LIST:tW:C/ /,/1g="one,two,three,four,five,six" +LIST:tw:C/ /,/="one two three four five six" +LIST:tw:C/ /,/g="one two three four five six" +LIST:tw:C/ /,/1g="one two three four five six" +LIST:tw:tW:C/ /,/="one,two three four five six" +LIST:tW:tw:C/ /,/="one two three four five six" +exit status 0 diff --git a/usr.bin/make/unit-tests/modword b/usr.bin/make/unit-tests/modword.mk index 47f1677208e..00a56de1987 100644 --- a/usr.bin/make/unit-tests/modword +++ b/usr.bin/make/unit-tests/modword.mk @@ -1,4 +1,4 @@ -# $Id: modword,v 1.1 2003/09/27 21:29:37 sjg Exp $ +# $Id: modword.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ # # Test behaviour of new :[] modifier diff --git a/usr.bin/make/unit-tests/order.exp b/usr.bin/make/unit-tests/order.exp new file mode 100644 index 00000000000..d876914ffc9 --- /dev/null +++ b/usr.bin/make/unit-tests/order.exp @@ -0,0 +1,4 @@ +Making the.c +Making the.h +Making the.o from the.h the.c +exit status 0 diff --git a/usr.bin/make/unit-tests/order b/usr.bin/make/unit-tests/order.mk index 175da471fe3..f90b627d9e5 100644 --- a/usr.bin/make/unit-tests/order +++ b/usr.bin/make/unit-tests/order.mk @@ -1,4 +1,4 @@ -# $NetBSD: order,v 1.1 2012/11/09 19:08:28 sjg Exp $ +# $NetBSD: order.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ # Test that .ORDER is handled correctly. # The explicit dependency the.o: the.h will make us examine the.h diff --git a/usr.bin/make/unit-tests/phony-end.exp b/usr.bin/make/unit-tests/phony-end.exp new file mode 100644 index 00000000000..f1bff4ef6d5 --- /dev/null +++ b/usr.bin/make/unit-tests/phony-end.exp @@ -0,0 +1,6 @@ +.TARGET="phony" .PREFIX="phony" .IMPSRC="" +.TARGET="all" .PREFIX="all" .IMPSRC="" +.TARGET="ok" .PREFIX="ok" .IMPSRC="" +.TARGET="also.ok" .PREFIX="also.ok" .IMPSRC="" +.TARGET="bug" .PREFIX="bug" .IMPSRC="" +exit status 0 diff --git a/usr.bin/make/unit-tests/phony-end b/usr.bin/make/unit-tests/phony-end.mk index f7e627c70bc..92cc0e6bbdc 100644 --- a/usr.bin/make/unit-tests/phony-end +++ b/usr.bin/make/unit-tests/phony-end.mk @@ -1,4 +1,4 @@ -# $Id: phony-end,v 1.1 2011/09/29 23:38:04 sjg Exp $ +# $Id: phony-end.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ all ok also.ok bug phony: @echo '${.TARGET .PREFIX .IMPSRC:L:@v@$v="${$v}"@}' diff --git a/usr.bin/make/unit-tests/posix.exp b/usr.bin/make/unit-tests/posix.exp new file mode 100644 index 00000000000..7e74cabadfb --- /dev/null +++ b/usr.bin/make/unit-tests/posix.exp @@ -0,0 +1,23 @@ +Posix says we should execute the command as if run by system(3) +Expect 'Hello,' and 'World!' +Hello, +World! +a command +a command prefixed by '+' executes even with -n +another command +make -n +echo a command +echo "a command prefixed by '+' executes even with -n" +a command prefixed by '+' executes even with -n +echo another command +make -n -j1 +{ echo a command +} || exit $? +echo "a command prefixed by '+' executes even with -n" +a command prefixed by '+' executes even with -n +{ echo another command +} || exit $? +Now we expect an error... +*** Error code 1 (continuing) +`all' not remade because of errors. +exit status 0 diff --git a/usr.bin/make/unit-tests/posix b/usr.bin/make/unit-tests/posix.mk index b685c646af3..a73e2e57453 100644 --- a/usr.bin/make/unit-tests/posix +++ b/usr.bin/make/unit-tests/posix.mk @@ -1,4 +1,4 @@ -# $Id: posix,v 1.1 2004/05/07 08:12:16 sjg Exp $ +# $Id: posix.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ all: x plus subs err diff --git a/usr.bin/make/unit-tests/qequals.exp b/usr.bin/make/unit-tests/qequals.exp new file mode 100644 index 00000000000..6b2f4dce699 --- /dev/null +++ b/usr.bin/make/unit-tests/qequals.exp @@ -0,0 +1,2 @@ +V.i386 ?= OK +exit status 0 diff --git a/usr.bin/make/unit-tests/qequals b/usr.bin/make/unit-tests/qequals.mk index 2010c088bd5..db6d9c3f917 100644 --- a/usr.bin/make/unit-tests/qequals +++ b/usr.bin/make/unit-tests/qequals.mk @@ -1,4 +1,4 @@ -# $Id: qequals,v 1.1 2008/03/31 00:12:21 sjg Exp $ +# $Id: qequals.mk,v 1.1 2014/08/21 13:44:51 apb Exp $ M= i386 V.i386= OK diff --git a/usr.bin/make/unit-tests/sunshcmd.exp b/usr.bin/make/unit-tests/sunshcmd.exp new file mode 100644 index 00000000000..b14f6b68a41 --- /dev/null +++ b/usr.bin/make/unit-tests/sunshcmd.exp @@ -0,0 +1,4 @@ +TEST1=hello +TEST2=bye +TEST3=later +exit status 0 diff --git a/usr.bin/make/unit-tests/sunshcmd b/usr.bin/make/unit-tests/sunshcmd.mk index e3baf901e51..e3baf901e51 100644 --- a/usr.bin/make/unit-tests/sunshcmd +++ b/usr.bin/make/unit-tests/sunshcmd.mk diff --git a/usr.bin/make/unit-tests/sysv.exp b/usr.bin/make/unit-tests/sysv.exp new file mode 100644 index 00000000000..4cce2de3191 --- /dev/null +++ b/usr.bin/make/unit-tests/sysv.exp @@ -0,0 +1,7 @@ +FOOBAR = +FOOBAR = foobar fubar +fun +fun +fun +In the Sun +exit status 0 diff --git a/usr.bin/make/unit-tests/sysv b/usr.bin/make/unit-tests/sysv.mk index 2d304f6b449..e783eb81e85 100644 --- a/usr.bin/make/unit-tests/sysv +++ b/usr.bin/make/unit-tests/sysv.mk @@ -1,4 +1,4 @@ -# $Id: sysv,v 1.2 2011/06/03 21:10:42 sjg Exp $ +# $Id: sysv.mk,v 1.1 2014/08/21 13:44:52 apb Exp $ FOO ?= FOOBAR = $(FOO:=bar) diff --git a/usr.bin/make/unit-tests/ternary.exp b/usr.bin/make/unit-tests/ternary.exp new file mode 100644 index 00000000000..ed9c1bd9200 --- /dev/null +++ b/usr.bin/make/unit-tests/ternary.exp @@ -0,0 +1,10 @@ +The answer is unknown +The answer is unknown +The answer is empty +The answer is known +The answer is +The answer is empty +The answer is known +The answer is 42 +The answer is 42 +exit status 0 diff --git a/usr.bin/make/unit-tests/ternary b/usr.bin/make/unit-tests/ternary.mk index 77f834981c6..77f834981c6 100644 --- a/usr.bin/make/unit-tests/ternary +++ b/usr.bin/make/unit-tests/ternary.mk diff --git a/usr.bin/make/unit-tests/test.exp b/usr.bin/make/unit-tests/test.exp deleted file mode 100644 index 815dde8488b..00000000000 --- a/usr.bin/make/unit-tests/test.exp +++ /dev/null @@ -1,394 +0,0 @@ -comment testing start -this is foo -This is how a comment looks: # comment -comment testing done -make: "cond1" line 75: warning: extra else -make: "cond1" line 85: warning: extra else -2 is prime -A='other' B='unknown' C='clever' o='no,no' -Passed: - var - ("var") - (var != var) - var != var - !((var != var) && defined(name)) - var == quoted - -1 is not prime -2 is prime -3 is prime -4 is not prime -5 is prime - -make: warning: String comparison operator should be either == or != -make: Bad conditional expression `"0" > 0' in "0" > 0?OK:No - -OK -make: "error" line 3: just FYI -make: "error" line 4: warning: this could be serious -make: "error" line 5: this is fatal -UT_DOLLAR=This is $UT_FU -UT_FOO=foobar is fubar -UT_FU=fubar -UT_TEST=export -UT_ZOO=hoopie -UT_ALL=even this gets exported -UT_BADDIR=unit-tests -UT_DOLLAR=This is $UT_FU -UT_F=fine -UT_FOO=foobar is fubar -UT_FU=fubar -UT_NO=all -UT_OK=good -UT_OKDIR=unit-tests -UT_TEST=export-all -UT_ZOO=hoopie -make: -UT_TEST=export-env -UT_ENV=not-exported -UT_EXP=not-exported -env: -UT_TEST=export-env -UT_ENV=exported -UT_EXP=exported -At first, I am -happy -and now: sad -.ERROR: Looks like 'sad' is upset. -*** Error code 1 - -Stop. -make: stopped in unit-tests -simple.1 -simple.1 -simple.2 -simple.2 -recursive.1.1.* -recursive.1.1.* -recursive.1.1.* -recursive.1.1.* -recursive.1.99 -recursive.1.99 -recursive.2.1.* -recursive.2.1.* -recursive.2.1.* -recursive.2.1.* -recursive.2.99 -recursive.2.99 -shared.0 -shared.0 -shared.1.99 -shared.1.99 -shared.2.1 -shared.2.1 -shared.2.99 -shared.2.99 -make: Graph cycles through `cycle.2.99' -make: Graph cycles through `cycle.2.98' -make: Graph cycles through `cycle.2.97' -cycle.1.99 -cycle.1.99 -x=one -x="two and three" -x=four -x="five" -x=-I/this -x=-I"This or that" -x=-Ithat -x="-DTHIS=\"this and that\"" -cfl=-I/this -I"This or that" -Ithat "-DTHIS=\"this and that\"" -a=one b="two and three" -a=four b="five" -a=ONE b="TWO AND THREE" -a=FOUR b="FIVE" -We expect an error next: -make: "forloop" line 38: Wrong number of words (9) in .for substitution list with 2 vars -make: Fatal errors encountered -- cannot continue -make: stopped in unit-tests -OK -.for with :S;... OK -b2af338b -3360ac65 -7747f046 -9ca87054 -880fe816 -208fcbd3 -d5d376eb -de41416c -Expect: Unknown modifier 'Z' -make: Unknown modifier 'Z' -VAR:Z= -Expect: Unknown modifier 'Z' -make: Unknown modifier 'Z' -VAR:Z= -Expect: Unclosed variable specification for VAR -make: Unclosed variable specification (expecting '}') for "VAR" (value "Thevariable") modifier S -VAR:S,V,v,=Thevariable -Expect: Unclosed variable specification for VAR -make: Unclosed variable specification after complex modifier (expecting '}') for VAR -VAR:S,V,v,=Thevariable -Expect: Unclosed substitution for VAR (, missing) -make: Unclosed substitution for VAR (, missing) -VAR:S,V,v= -LIB=a X_LIBS:M${LIB${LIB:tu}} is "/tmp/liba.a" -LIB=a X_LIBS:M*/lib${LIB}.a is "/tmp/liba.a" -LIB=a X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBA.A" -LIB=b X_LIBS:M${LIB${LIB:tu}} is "" -LIB=b X_LIBS:M*/lib${LIB}.a is "" -LIB=b X_LIBS:M*/lib${LIB}.a:tu is "" -LIB=c X_LIBS:M${LIB${LIB:tu}} is "" -LIB=c X_LIBS:M*/lib${LIB}.a is "" -LIB=c X_LIBS:M*/lib${LIB}.a:tu is "" -LIB=d X_LIBS:M${LIB${LIB:tu}} is "/tmp/libd.a" -LIB=d X_LIBS:M*/lib${LIB}.a is "/tmp/libd.a" -LIB=d X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBD.A" -LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/libe.a" -LIB=e X_LIBS:M*/lib${LIB}.a is "/tmp/libe.a" -LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A" -Mscanner=OK -path=':/bin:/tmp::/:.:/no/such/dir:.' -path='/bin:/tmp:/:/no/such/dir' -path='/bin:/tmp:/:/no/such/dir' -path='/bin':'/tmp':'/':'/no/such/dir' -path='/bin':'/tmp':'/':'/no/such/dir' -path_/usr/xbin=/opt/xbin/ -paths=/bin /tmp / /no/such/dir /opt/xbin -PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN -The answer is 42 -LIST = one two three four five six seven eight nine ten -LIST:O = eight five four nine one seven six ten three two -LIST:Ox = Ok -LIST:O:Ox = Ok -LISTX = Ok -LISTSX = Ok -make: Bad modifier `:OX' for LIST -BADMOD 1 = } -make: Bad modifier `:OxXX' for LIST -BADMOD 2 = XX} -LIST="one two three four five six" -LIST:ts,="one,two,three,four,five,six" -LIST:ts/:tu="ONE/TWO/THREE/FOUR/FIVE/SIX" -LIST:ts::tu="ONE:TWO:THREE:FOUR:FIVE:SIX" -LIST:ts:tu="ONETWOTHREEFOURFIVESIX" -LIST:tu:ts/="ONE/TWO/THREE/FOUR/FIVE/SIX" -LIST:ts:="one:two:three:four:five:six" -LIST:ts="onetwothreefourfivesix" -LIST:ts:S/two/2/="one2threefourfivesix" -LIST:S/two/2/:ts="one2threefourfivesix" -LIST:ts/:S/two/2/="one/2/three/four/five/six" -Pretend the '/' in '/n' etc. below are back-slashes. -LIST:ts/n="one -two -three -four -five -six" -LIST:ts/t="one two three four five six" -LIST:ts/012:tu="ONE -TWO -THREE -FOUR -FIVE -SIX" -make: Bad modifier `:tx' for LIST -LIST:tx="}" -make: Bad modifier `:ts\x' for LIST -LIST:ts/x:tu="\x:tu}" -FU_mod-ts="a/b/cool" -FU_mod-ts:ts:T="cool" == cool? -B.${AAA:ts}="Baaa" == Baaa? -make: Bad modifier `:[]' for LIST -LIST:[]="" is an error -LIST:[0]="one two three four five six" -LIST:[0x0]="one two three four five six" -LIST:[000]="one two three four five six" -LIST:[*]="one two three four five six" -LIST:[@]="one two three four five six" -LIST:[0]:C/ /,/="one,two three four five six" -LIST:[0]:C/ /,/g="one,two,three,four,five,six" -LIST:[0]:C/ /,/1g="one,two,three,four,five,six" -LIST:[*]:C/ /,/="one,two three four five six" -LIST:[*]:C/ /,/g="one,two,three,four,five,six" -LIST:[*]:C/ /,/1g="one,two,three,four,five,six" -LIST:[@]:C/ /,/="one two three four five six" -LIST:[@]:C/ /,/g="one two three four five six" -LIST:[@]:C/ /,/1g="one two three four five six" -LIST:[@]:[0]:C/ /,/="one,two three four five six" -LIST:[0]:[@]:C/ /,/="one two three four five six" -LIST:[@]:[*]:C/ /,/="one,two three four five six" -LIST:[*]:[@]:C/ /,/="one two three four five six" -EMPTY="" -EMPTY:[#]="1" == 1 ? -ESCAPEDSPACE="\ " -ESCAPEDSPACE:[#]="1" == 1 ? -REALLYSPACE=" " -REALLYSPACE:[#]="1" == 1 ? -LIST:[#]="6" -LIST:[0]:[#]="1" == 1 ? -LIST:[*]:[#]="1" == 1 ? -LIST:[@]:[#]="6" -LIST:[1]:[#]="1" -LIST:[1..3]:[#]="3" -EMPTY:[1]="" -ESCAPEDSPACE="\ " -ESCAPEDSPACE:[1]="\ " -REALLYSPACE=" " -REALLYSPACE:[1]="" == "" ? -REALLYSPACE:[*]:[1]=" " == " " ? -LIST:[1]="one" -make: Bad modifier `:[1.]' for LIST -LIST:[1.]="" is an error -make: Bad modifier `:[1].' for LIST -LIST:[1].="}" is an error -LIST:[2]="two" -LIST:[6]="six" -LIST:[7]="" -LIST:[999]="" -make: Bad modifier `:[-]' for LIST -LIST:[-]="" is an error -make: Bad modifier `:[--]' for LIST -LIST:[--]="" is an error -LIST:[-1]="six" -LIST:[-2]="five" -LIST:[-6]="one" -LIST:[-7]="" -LIST:[-999]="" -LONGLIST:[17]="17" -LONGLIST:[0x11]="17" -LONGLIST:[021]="17" -LIST:[0]:[1]="one two three four five six" -LIST:[*]:[1]="one two three four five six" -LIST:[@]:[1]="one" -LIST:[0]:[2]="" -LIST:[*]:[2]="" -LIST:[@]:[2]="two" -LIST:[*]:C/ /,/:[2]="" -LIST:[*]:C/ /,/:[*]:[2]="" -LIST:[*]:C/ /,/:[@]:[2]="three" -make: Bad modifier `:[1.]' for LIST -LIST:[1.]="" is an error -make: Bad modifier `:[1..]' for LIST -LIST:[1..]="" is an error -LIST:[1..1]="one" -make: Bad modifier `:[1..1.]' for LIST -LIST:[1..1.]="" is an error -LIST:[1..2]="one two" -LIST:[2..1]="two one" -LIST:[3..-2]="three four five" -LIST:[-4..4]="three four" -make: Bad modifier `:[0..1]' for LIST -LIST:[0..1]="" is an error -make: Bad modifier `:[-1..0]' for LIST -LIST:[-1..0]="" is an error -LIST:[-1..1]="six five four three two one" -LIST:[0..0]="one two three four five six" -LIST:[3..99]="three four five six" -LIST:[-3..-99]="four three two one" -LIST:[-99..-3]="one two three four" -HASH="#" == "#" ? -LIST:[${HASH}]="6" -LIST:[${ZERO}]="one two three four five six" -LIST:[${ZERO}x${ONE}]="one" -LIST:[${ONE}]="one" -LIST:[${MINUSONE}]="six" -LIST:[${STAR}]="one two three four five six" -LIST:[${AT}]="one two three four five six" -make: Bad modifier `:[${EMPTY' for LIST -LIST:[${EMPTY}]="" is an error -LIST:[${LONGLIST:[21]:S/2//}]="one" -LIST:[${LIST:[#]}]="six" -LIST:[${LIST:[${HASH}]}]="six" -LIST:S/ /,/="one two three four five six" -LIST:S/ /,/W="one,two three four five six" -LIST:S/ /,/gW="one,two,three,four,five,six" -EMPTY:S/^/,/="," -EMPTY:S/^/,/W="," -LIST:C/ /,/="one two three four five six" -LIST:C/ /,/W="one,two three four five six" -LIST:C/ /,/gW="one,two,three,four,five,six" -EMPTY:C/^/,/="," -EMPTY:C/^/,/W="," -LIST:tW="one two three four five six" -LIST:tw="one two three four five six" -LIST:tW:C/ /,/="one,two three four five six" -LIST:tW:C/ /,/g="one,two,three,four,five,six" -LIST:tW:C/ /,/1g="one,two,three,four,five,six" -LIST:tw:C/ /,/="one two three four five six" -LIST:tw:C/ /,/g="one two three four five six" -LIST:tw:C/ /,/1g="one two three four five six" -LIST:tw:tW:C/ /,/="one,two three four five six" -LIST:tW:tw:C/ /,/="one two three four five six" -Making the.c -Making the.h -Making the.o from the.h the.c -.TARGET="phony" .PREFIX="phony" .IMPSRC="" -.TARGET="all" .PREFIX="all" .IMPSRC="" -.TARGET="ok" .PREFIX="ok" .IMPSRC="" -.TARGET="also.ok" .PREFIX="also.ok" .IMPSRC="" -.TARGET="bug" .PREFIX="bug" .IMPSRC="" -Posix says we should execute the command as if run by system(3) -Expect 'Hello,' and 'World!' -Hello, -World! -a command -a command prefixed by '+' executes even with -n -another command -make -n -echo a command -echo "a command prefixed by '+' executes even with -n" -a command prefixed by '+' executes even with -n -echo another command -make -n -j1 -{ echo a command -} || exit $? -echo "a command prefixed by '+' executes even with -n" -a command prefixed by '+' executes even with -n -{ echo another command -} || exit $? -Now we expect an error... -*** Error code 1 (continuing) -`all' not remade because of errors. -V.i386 ?= OK -TEST1=hello -TEST2=bye -TEST3=later -FOOBAR = -FOOBAR = foobar fubar -fun -fun -fun -In the Sun -The answer is unknown -The answer is unknown -The answer is empty -The answer is known -The answer is -The answer is empty -The answer is known -The answer is 42 -The answer is 42 -UT_DOLLAR=This is $UT_FU -UT_FU=fubar -UT_TEST=unexport -UT_TEST=unexport-env -default FU=<v>fu</v> FOO=<v>foo</v> VAR=<v></v> -two FU=<v>bar</v> FOO=<v>goo</v> VAR=<v></v> -three FU=<v>bar</v> FOO=<v>goo</v> VAR=<v></v> -four FU=<v>bar</v> FOO=<v>goo</v> VAR=<v>Internal</v> -five FU=<v>bar</v> FOO=<v>goo</v> VAR=<v>Internal</v> -five v=is x k=is x -six v=is y k=is y -show-v v=override k=override -sh: /bin/no/such/command: not found -make: "varshell" line 5: warning: "/bin/no/such/command" returned non-zero status -make: "varshell" line 6: warning: "kill -ALRM $$" exited on a signal -make: "varshell" line 7: warning: "false" returned non-zero status -make: "varshell" line 8: warning: "echo "output before the error"; false" returned non-zero status -EXEC_FAILED='' -TERMINATED_BY_SIGNAL='' -ERROR_NO_OUTPUT='' -ERROR_WITH_OUTPUT='output before the error' -NO_ERROR_NO_OUTPUT='' -NO_ERROR_WITH_OUTPUT='this is good' -*** Error code 1 (ignored) -*** Error code 1 (ignored) diff --git a/usr.bin/make/unit-tests/unexport-env.exp b/usr.bin/make/unit-tests/unexport-env.exp new file mode 100644 index 00000000000..6d43cab48a5 --- /dev/null +++ b/usr.bin/make/unit-tests/unexport-env.exp @@ -0,0 +1,2 @@ +UT_TEST=unexport-env +exit status 0 diff --git a/usr.bin/make/unit-tests/unexport-env b/usr.bin/make/unit-tests/unexport-env.mk index 238885611a1..b8192f1dd60 100644 --- a/usr.bin/make/unit-tests/unexport-env +++ b/usr.bin/make/unit-tests/unexport-env.mk @@ -1,7 +1,7 @@ -# $Id: unexport-env,v 1.1 2009/11/19 00:30:25 sjg Exp $ +# $Id: unexport-env.mk,v 1.1 2014/08/21 13:44:52 apb Exp $ # pick up a bunch of exported vars -.include "export" +.include "export.mk" # an example of setting up a minimal environment. PATH = /bin:/usr/bin:/sbin:/usr/sbin diff --git a/usr.bin/make/unit-tests/unexport.exp b/usr.bin/make/unit-tests/unexport.exp new file mode 100644 index 00000000000..7b16ea3659a --- /dev/null +++ b/usr.bin/make/unit-tests/unexport.exp @@ -0,0 +1,4 @@ +UT_DOLLAR=This is $UT_FU +UT_FU=fubar +UT_TEST=unexport +exit status 0 diff --git a/usr.bin/make/unit-tests/unexport b/usr.bin/make/unit-tests/unexport.mk index 34c88c9ce9b..b3d7d349d6d 100644 --- a/usr.bin/make/unit-tests/unexport +++ b/usr.bin/make/unit-tests/unexport.mk @@ -1,7 +1,7 @@ -# $Id: unexport,v 1.1 2009/11/19 00:30:25 sjg Exp $ +# $Id: unexport.mk,v 1.1 2014/08/21 13:44:52 apb Exp $ # pick up a bunch of exported vars -.include "export" +.include "export.mk" .unexport UT_ZOO UT_FOO diff --git a/usr.bin/make/unit-tests/varcmd.exp b/usr.bin/make/unit-tests/varcmd.exp new file mode 100644 index 00000000000..34dd637f93e --- /dev/null +++ b/usr.bin/make/unit-tests/varcmd.exp @@ -0,0 +1,9 @@ +default FU=<v>fu</v> FOO=<v>foo</v> VAR=<v></v> +two FU=<v>bar</v> FOO=<v>goo</v> VAR=<v></v> +three FU=<v>bar</v> FOO=<v>goo</v> VAR=<v></v> +four FU=<v>bar</v> FOO=<v>goo</v> VAR=<v>Internal</v> +five FU=<v>bar</v> FOO=<v>goo</v> VAR=<v>Internal</v> +five v=is x k=is x +six v=is y k=is y +show-v v=override k=override +exit status 0 diff --git a/usr.bin/make/unit-tests/varcmd b/usr.bin/make/unit-tests/varcmd.mk index 60343acb252..116795fe1a7 100644 --- a/usr.bin/make/unit-tests/varcmd +++ b/usr.bin/make/unit-tests/varcmd.mk @@ -1,4 +1,4 @@ -# $Id: varcmd,v 1.3 2008/05/14 14:27:02 sjg Exp $ +# $Id: varcmd.mk,v 1.1 2014/08/21 13:44:52 apb Exp $ # # Test behaviour of recursive make and vars set on command line. diff --git a/usr.bin/make/unit-tests/varshell.exp b/usr.bin/make/unit-tests/varshell.exp new file mode 100644 index 00000000000..2c9b015143f --- /dev/null +++ b/usr.bin/make/unit-tests/varshell.exp @@ -0,0 +1,12 @@ +sh: /bin/no/such/command: not found +make: "varshell.mk" line 5: warning: "/bin/no/such/command" returned non-zero status +make: "varshell.mk" line 6: warning: "kill -ALRM $$" exited on a signal +make: "varshell.mk" line 7: warning: "false" returned non-zero status +make: "varshell.mk" line 8: warning: "echo "output before the error"; false" returned non-zero status +EXEC_FAILED='' +TERMINATED_BY_SIGNAL='' +ERROR_NO_OUTPUT='' +ERROR_WITH_OUTPUT='output before the error' +NO_ERROR_NO_OUTPUT='' +NO_ERROR_WITH_OUTPUT='this is good' +exit status 0 diff --git a/usr.bin/make/unit-tests/varshell b/usr.bin/make/unit-tests/varshell.mk index ec11c7a698b..19a8eecaaad 100644 --- a/usr.bin/make/unit-tests/varshell +++ b/usr.bin/make/unit-tests/varshell.mk @@ -1,4 +1,4 @@ -# $Id: varshell,v 1.1 2014/08/20 08:39:14 apb Exp $ +# $Id: varshell.mk,v 1.1 2014/08/21 13:44:52 apb Exp $ # # Test VAR != shell command |
