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 OP_SUBMAKE
details: https://anonhg.NetBSD.org/src/rev/894fe4296229
branches: trunk
changeset: 1016055:894fe4296229
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 07 23:25:06 2020 +0000
description:
make(1): add test for OP_SUBMAKE
diffstat:
usr.bin/make/unit-tests/Makefile | 4 ++-
usr.bin/make/unit-tests/gnode-submake.exp | 11 ++++++++
usr.bin/make/unit-tests/gnode-submake.mk | 42 +++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 1 deletions(-)
diffs (86 lines):
diff -r 23333694d64a -r 894fe4296229 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sat Nov 07 22:29:58 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sat Nov 07 23:25:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.189 2020/11/07 20:01:17 rillig Exp $
+# $NetBSD: Makefile,v 1.190 2020/11/07 23:25:06 rillig Exp $
#
# Unit tests for make(1)
#
@@ -172,6 +172,7 @@
TESTS+= export-variants
TESTS+= forloop
TESTS+= forsubst
+TESTS+= gnode-submake
TESTS+= hanoi-include
TESTS+= impsrc
TESTS+= include-main
@@ -440,6 +441,7 @@
# Some tests need an additional round of postprocessing.
POSTPROC.deptgt-suffixes= \
${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
+POSTPROC.gnode-submake= awk '/Input graph/, /^$$/'
POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
# Some tests reuse other tests, which makes them unnecessarily fragile.
diff -r 23333694d64a -r 894fe4296229 usr.bin/make/unit-tests/gnode-submake.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/gnode-submake.exp Sat Nov 07 23:25:06 2020 +0000
@@ -0,0 +1,11 @@
+#*** Input graph:
+# all, made UNMADE, type OP_DEPENDS, flags none
+# makeinfo, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none
+# make-index, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# braces-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# braces-no-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# braces-no-dot-modifier, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none
+# parentheses-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# parentheses-no-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+
+exit status 0
diff -r 23333694d64a -r 894fe4296229 usr.bin/make/unit-tests/gnode-submake.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/gnode-submake.mk Sat Nov 07 23:25:06 2020 +0000
@@ -0,0 +1,42 @@
+# $NetBSD: gnode-submake.mk,v 1.1 2020/11/07 23:25:06 rillig Exp $
+#
+# Test whether OP_SUBMAKE is determined correctly. If it is, this node's
+# shell commands are connected to the make process via pipes, to coordinate
+# the number of running jobs.
+#
+# Determining whether a node is a sub-make node happens when the node is
+# parsed. This information is only used in parallel mode, but the result
+# from parsing is available in compat mode as well.
+
+.MAKEFLAGS: -n -dg1
+
+all: makeinfo make-index
+all: braces-dot braces-no-dot
+all: braces-no-dot-modifier
+all: parentheses-dot parentheses-no-dot
+
+makeinfo:
+ # The command contains the substring "make", but not as a whole word.
+ : makeinfo submake
+
+make-index:
+ # The command contains the word "make", therefore it is considered a
+ # possible sub-make. It isn't really, but that doesn't hurt.
+ : make-index
+
+braces-dot:
+ : ${.MAKE}
+
+braces-no-dot:
+ : ${MAKE}
+
+braces-no-dot-modifier:
+ # The command refers to MAKE, but not in its pure form. Therefore it
+ # is not considered a sub-make.
+ : ${MAKE:T}
+
+parentheses-dot:
+ : $(.MAKE)
+
+parentheses-no-dot:
+ : $(MAKE)
Home |
Main Index |
Thread Index |
Old Index