Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for the -n option ...



details:   https://anonhg.NetBSD.org/src/rev/d4ddf8f9cda4
branches:  trunk
changeset: 978961:d4ddf8f9cda4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Dec 09 07:57:51 2020 +0000

description:
make(1): add test for the -n option combined with RunFlags

diffstat:

 distrib/sets/lists/tests/mi                        |   4 +-
 usr.bin/make/unit-tests/Makefile                   |   7 +++-
 usr.bin/make/unit-tests/opt-jobs-no-action.mk      |   9 +++-
 usr.bin/make/unit-tests/opt-no-action-runflags.exp |  34 ++++++++++++++++++++++
 usr.bin/make/unit-tests/opt-no-action-runflags.mk  |  32 ++++++++++++++++++++
 5 files changed, 81 insertions(+), 5 deletions(-)

diffs (150 lines):

diff -r d145ed9b7529 -r d4ddf8f9cda4 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Dec 09 07:24:52 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Dec 09 07:57:51 2020 +0000
@@ -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
diff -r d145ed9b7529 -r d4ddf8f9cda4 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Wed Dec 09 07:24:52 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Wed Dec 09 07:57:51 2020 +0000
@@ -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-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,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.
diff -r d145ed9b7529 -r d4ddf8f9cda4 usr.bin/make/unit-tests/opt-jobs-no-action.mk
--- a/usr.bin/make/unit-tests/opt-jobs-no-action.mk     Wed Dec 09 07:24:52 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-jobs-no-action.mk     Wed Dec 09 07:57:51 2020 +0000
@@ -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 @@
 # 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
diff -r d145ed9b7529 -r d4ddf8f9cda4 usr.bin/make/unit-tests/opt-no-action-runflags.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/opt-no-action-runflags.exp        Wed Dec 09 07:57:51 2020 +0000
@@ -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
diff -r d145ed9b7529 -r d4ddf8f9cda4 usr.bin/make/unit-tests/opt-no-action-runflags.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/opt-no-action-runflags.mk Wed Dec 09 07:57:51 2020 +0000
@@ -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 $@'



Home | Main Index | Thread Index | Old Index