Module Name: src Committed By: rillig Date: Wed Dec 9 07:57:52 UTC 2020
Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile opt-jobs-no-action.mk Added Files: src/usr.bin/make/unit-tests: opt-no-action-runflags.exp opt-no-action-runflags.mk Log Message: make(1): add test for the -n option combined with RunFlags To generate a diff of this commit: cvs rdiff -u -r1.986 -r1.987 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-jobs-no-action.mk cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/opt-no-action-runflags.exp \ src/usr.bin/make/unit-tests/opt-no-action-runflags.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.986 src/distrib/sets/lists/tests/mi:1.987 --- src/distrib/sets/lists/tests/mi:1.986 Wed Dec 9 00:25:00 2020 +++ src/distrib/sets/lists/tests/mi Wed Dec 9 07:57:51 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.986 2020/12/09 00:25:00 rillig Exp $ +# $NetBSD: mi,v 1.987 2020/12/09 07:57:51 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5229,6 +5229,8 @@ ./usr/tests/usr.bin/make/unit-tests/opt-m-include-dir.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-no-action-at-all.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-no-action-at-all.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/opt-no-action-runflags.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/opt-no-action-runflags.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-no-action.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-no-action.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/opt-query.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.241 src/usr.bin/make/unit-tests/Makefile:1.242 --- src/usr.bin/make/unit-tests/Makefile:1.241 Wed Dec 9 00:25:00 2020 +++ src/usr.bin/make/unit-tests/Makefile Wed Dec 9 07:57:52 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.241 2020/12/09 00:25:00 rillig Exp $ +# $NetBSD: Makefile,v 1.242 2020/12/09 07:57:52 rillig Exp $ # # Unit tests for make(1) # @@ -242,6 +242,7 @@ TESTS+= opt-keep-going-multiple TESTS+= opt-m-include-dir TESTS+= opt-no-action TESTS+= opt-no-action-at-all +TESTS+= opt-no-action-runflags TESTS+= opt-query TESTS+= opt-raw TESTS+= opt-silent @@ -475,6 +476,10 @@ SED_CMDS.opt-debug-jobs+= -e 's,JobFinis SED_CMDS.opt-debug-jobs+= -e 's,Command: ${.SHELL:T},Command: <shell>,' # The "-q" may be there or not, see jobs.c, variable shells. SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: <shell>\) -q,\1,' +SED_CMDS.opt-no-action-runflags= \ + -e '/^echo hide-from-output/d' \ + -e 's,hide-from-output ,,' \ + -e 's,hide-from-output,,' # For Compat_RunCommand, useShell == FALSE. SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,<not found: ...>,' # For Compat_RunCommand, useShell == TRUE. Index: src/usr.bin/make/unit-tests/opt-jobs-no-action.mk diff -u src/usr.bin/make/unit-tests/opt-jobs-no-action.mk:1.3 src/usr.bin/make/unit-tests/opt-jobs-no-action.mk:1.4 --- src/usr.bin/make/unit-tests/opt-jobs-no-action.mk:1.3 Wed Dec 9 07:24:52 2020 +++ src/usr.bin/make/unit-tests/opt-jobs-no-action.mk Wed Dec 9 07:57:52 2020 @@ -1,4 +1,4 @@ -# $NetBSD: opt-jobs-no-action.mk,v 1.3 2020/12/09 07:24:52 rillig Exp $ +# $NetBSD: opt-jobs-no-action.mk,v 1.4 2020/12/09 07:57:52 rillig Exp $ # # Tests for the combination of the options -j and -n, which prints the # commands instead of actually running them. @@ -7,7 +7,11 @@ # without the -j. This is because all this code is implemented twice, once # in compat.c and once in job.c. # -# See opt-jobs.mk for the corresponding tests without the -n option. +# See also: +# opt-jobs.mk +# The corresponding tests without the -n option +# opt-no-action-combined.mk +# The corresponding tests without the -j option .MAKEFLAGS: -j1 -n @@ -61,7 +65,6 @@ documented: .PHONY # Test all combinations of the 3 RunFlags. # # TODO: Closely inspect the output whether it makes sense. -# XXX: The output should not contain the 'echo silent=...' lines. # XXX: silent=no always=no ignerr={no,yes} should be almost the same. # SILENT.no= # none Added files: Index: src/usr.bin/make/unit-tests/opt-no-action-runflags.exp diff -u /dev/null src/usr.bin/make/unit-tests/opt-no-action-runflags.exp:1.1 --- /dev/null Wed Dec 9 07:57:52 2020 +++ src/usr.bin/make/unit-tests/opt-no-action-runflags.exp Wed Dec 9 07:57:52 2020 @@ -0,0 +1,34 @@ +begin combined + +silent=no always=no ignerr=no +echo running + +silent=no always=no ignerr=yes +echo running; false + +silent=no always=yes ignerr=no +echo running +running + +silent=no always=yes ignerr=yes +echo running; false +running +*** Error code 1 (ignored) + +silent=yes always=no ignerr=no +echo running + +silent=yes always=no ignerr=yes +echo running; false + +silent=yes always=yes ignerr=no +echo running +running + +silent=yes always=yes ignerr=yes +echo running; false +running +*** Error code 1 (ignored) + +end combined +exit status 0 Index: src/usr.bin/make/unit-tests/opt-no-action-runflags.mk diff -u /dev/null src/usr.bin/make/unit-tests/opt-no-action-runflags.mk:1.1 --- /dev/null Wed Dec 9 07:57:52 2020 +++ src/usr.bin/make/unit-tests/opt-no-action-runflags.mk Wed Dec 9 07:57:52 2020 @@ -0,0 +1,32 @@ +# $NetBSD: opt-no-action-runflags.mk,v 1.1 2020/12/09 07:57:52 rillig Exp $ +# +# Tests for the -n command line option, which runs almost no commands, +# combined with the RunFlags '@', '-', '+' for individual commands. +# +# See also: +# opt-jobs-no-action.mk +# The corresponding test with the -j option + +.MAKEFLAGS: -n + +all: .PHONY combined + +SILENT.no= # none +SILENT.yes= @ +ALWAYS.no= # none +ALWAYS.yes= + +IGNERR.no= echo running +IGNERR.yes= -echo running; false +# +combined: .PHONY + @+echo hide-from-output 'begin $@'; echo +.for silent in no yes +. for always in no yes +. for ignerr in no yes + @+echo hide-from-output silent=${silent} always=${always} ignerr=${ignerr} + ${SILENT.${silent}}${ALWAYS.${always}}${IGNERR.${ignerr}} + @+echo hide-from-output +. endfor +. endfor +.endfor + @+echo hide-from-output 'end $@'