Module Name:    src
Committed By:   rillig
Date:           Sat Nov  7 23:25:06 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: Makefile
Added Files:
        src/usr.bin/make/unit-tests: gnode-submake.exp gnode-submake.mk

Log Message:
make(1): add test for OP_SUBMAKE


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/gnode-submake.exp \
    src/usr.bin/make/unit-tests/gnode-submake.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.189 src/usr.bin/make/unit-tests/Makefile:1.190
--- src/usr.bin/make/unit-tests/Makefile:1.189	Sat Nov  7 20:01:17 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Nov  7 23:25:06 2020
@@ -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-env
 TESTS+=		export-variants
 TESTS+=		forloop
 TESTS+=		forsubst
+TESTS+=		gnode-submake
 TESTS+=		hanoi-include
 TESTS+=		impsrc
 TESTS+=		include-main
@@ -440,6 +441,7 @@ SED_CMDS.varname-dot-shell+=	-e 's,\[/[^
 # 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.

Added files:

Index: src/usr.bin/make/unit-tests/gnode-submake.exp
diff -u /dev/null src/usr.bin/make/unit-tests/gnode-submake.exp:1.1
--- /dev/null	Sat Nov  7 23:25:06 2020
+++ src/usr.bin/make/unit-tests/gnode-submake.exp	Sat Nov  7 23:25:06 2020
@@ -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
Index: src/usr.bin/make/unit-tests/gnode-submake.mk
diff -u /dev/null src/usr.bin/make/unit-tests/gnode-submake.mk:1.1
--- /dev/null	Sat Nov  7 23:25:06 2020
+++ src/usr.bin/make/unit-tests/gnode-submake.mk	Sat Nov  7 23:25:06 2020
@@ -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)

Reply via email to