Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): normalize output of test sh-dots for n...



details:   https://anonhg.NetBSD.org/src/rev/29db203887cd
branches:  trunk
changeset: 946761:29db203887cd
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 07 22:27:56 2020 +0000

description:
make(1): normalize output of test sh-dots for non-native mode

diffstat:

 usr.bin/make/test-variants.sh            |   8 +++++++-
 usr.bin/make/unit-tests/Makefile         |   8 ++++++--
 usr.bin/make/unit-tests/sh-dots.exp      |  12 ++++++------
 usr.bin/make/unit-tests/sh-meta-chars.mk |  17 +++++++++++++----
 4 files changed, 32 insertions(+), 13 deletions(-)

diffs (103 lines):

diff -r d731a468b2b2 -r 29db203887cd usr.bin/make/test-variants.sh
--- a/usr.bin/make/test-variants.sh     Mon Dec 07 21:35:43 2020 +0000
+++ b/usr.bin/make/test-variants.sh     Mon Dec 07 22:27:56 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.7 2020/11/29 21:27:08 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.8 2020/12/07 22:27:56 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -149,6 +149,12 @@
 #
 testcase USER_CPPFLAGS="-DNDEBUG"
 
+# Only in native mode, make dares to use a shortcut in Compat_RunCommand
+# that circumvents the shell and instead calls execvp directly.
+# Another effect is that the shell is run with -q, which prevents the
+# -x and -v flags from echoing the commands from profile files.
+testcase USER_CPPFLAGS="-UMAKE_NATIVE -DHAVE_STRERROR -DHAVE_SETENV -DHAVE_VSNPRINTF"
+
 # Running the code coverage using gcov takes a long time.  Most of this
 # time is spent in gcov_read_unsigned because gcov_open sets the .gcda
 # file to unbuffered, which means that every single byte needs its own
diff -r d731a468b2b2 -r 29db203887cd usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Mon Dec 07 21:35:43 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Mon Dec 07 22:27:56 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.239 2020/12/07 21:35:43 rillig Exp $
+# $NetBSD: Makefile,v 1.240 2020/12/07 22:27:56 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -474,7 +474,11 @@
 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.sh-dots=              -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,'
+# For Compat_RunCommand, useShell == FALSE.
+SED_CMDS.sh-dots=              -e 's,^.*\.\.\.:.*,<not found: ...>,'
+# For Compat_RunCommand, useShell == TRUE.
+SED_CMDS.sh-dots+=             -e 's,^make: exec(\(.*\)) failed (.*)$$,<not found: \1>,'
+SED_CMDS.sh-dots+=             -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1<nonzero>,'
 SED_CMDS.suff-main+=           ${STD_SED_CMDS.dg1}
 SED_CMDS.suff-main-several+=   ${STD_SED_CMDS.dg1}
 SED_CMDS.suff-transform-debug+=        ${STD_SED_CMDS.dg1}
diff -r d731a468b2b2 -r 29db203887cd usr.bin/make/unit-tests/sh-dots.exp
--- a/usr.bin/make/unit-tests/sh-dots.exp       Mon Dec 07 21:35:43 2020 +0000
+++ b/usr.bin/make/unit-tests/sh-dots.exp       Mon Dec 07 22:27:56 2020 +0000
@@ -1,19 +1,19 @@
 first first
 hidden hidden
-make: exec(...) failed (No such file or directory)
-*** Error code 1 (ignored)
+<not found: ...>
+*** Error code <nonzero> (ignored)
 hidden delayed hidden
 repeated repeated
 commented commented
 ...    # Run the below commands later
-<normalized: ...: not found>
-*** Error code 127 (ignored)
+<not found: ...>
+*** Error code <nonzero> (ignored)
 commented delayed commented
 indirect regular
 indirect-space regular
 ... 
-make: exec(...) failed (No such file or directory)
-*** Error code 1 (ignored)
+<not found: ...>
+*** Error code <nonzero> (ignored)
 indirect-space deferred
 first delayed first
 repeated delayed repeated
diff -r d731a468b2b2 -r 29db203887cd usr.bin/make/unit-tests/sh-meta-chars.mk
--- a/usr.bin/make/unit-tests/sh-meta-chars.mk  Mon Dec 07 21:35:43 2020 +0000
+++ b/usr.bin/make/unit-tests/sh-meta-chars.mk  Mon Dec 07 22:27:56 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: sh-meta-chars.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: sh-meta-chars.mk,v 1.4 2020/12/07 22:27:56 rillig Exp $
 #
 # Tests for running shell commands that contain meta-characters.
 #
@@ -9,7 +9,16 @@
 # See also:
 #      Compat_RunCommand, useShell
 
-# TODO: Implementation
+all:
+
+# The command "exit 0" contains no special characters, therefore it is
+# run directly via execv, but only if MAKE_NATIVE is defined.
+USING_EXEC!=   { echo 'all:; exit 0' | ${MAKE} -r -f - 1>/dev/null 2>&1; } \
+               && echo yes || echo no
 
-all:
-       @:;
+# It's hard to do any useful tests that result in the same output.
+# See SED_CMDS.sh-dots, which normalizes the test output for the specific
+# case of the special command '...'.
+.if ${USING_EXEC} != "yes" && ${USING_EXEC} != "no"
+.  error
+.endif



Home | Main Index | Thread Index | Old Index