Module Name:    src
Committed By:   rillig
Date:           Wed Jan 26 22:47:03 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: depsrc-meta.exp depsrc-meta.mk
            varname-dot-make-jobs.exp varname-dot-make-jobs.mk

Log Message:
tests/make: test meta mode in jobs mode


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-meta.exp \
    src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/depsrc-meta.mk
cvs rdiff -u -r1.1 -r1.2 \
    src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp

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/depsrc-meta.exp
diff -u src/usr.bin/make/unit-tests/depsrc-meta.exp:1.2 src/usr.bin/make/unit-tests/depsrc-meta.exp:1.3
--- src/usr.bin/make/unit-tests/depsrc-meta.exp:1.2	Fri Nov 27 08:36:10 2020
+++ src/usr.bin/make/unit-tests/depsrc-meta.exp	Wed Jan 26 22:47:03 2022
@@ -2,4 +2,6 @@ Skipping meta for actual-test: no comman
 Skipping meta for .END: .SPECIAL
 Targets from meta mode:
 | TARGET depsrc-meta-target
+Targets from meta mode in jobs mode:
+| TARGET depsrc-meta-target
 exit status 0
Index: src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk	Wed Jan 26 22:47:03 2022
@@ -1,8 +1,24 @@
-# $NetBSD: varname-dot-make-jobs.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-make-jobs.mk,v 1.3 2022/01/26 22:47:03 rillig Exp $
 #
-# Tests for the special .MAKE.JOBS variable.
+# Tests for the special .MAKE.JOBS variable, which is defined in jobs mode
+# only.  There it contains the number of jobs that may run in parallel.
 
-# TODO: Implementation
+.MAIN: all
+
+echo: .PHONY
+	@echo ${.MAKE.JOBS:Uundefined}
 
 all:
-	@:;
+	@${MAKE} -r -f ${MAKEFILE} echo
+	@${MAKE} -r -f ${MAKEFILE} echo -j1
+	@${MAKE} -r -f ${MAKEFILE} echo -j5
+	@${MAKE} -r -f ${MAKEFILE} echo -j20
+	@${MAKE} -r -f ${MAKEFILE} echo -j00000000000000000000000000000001
+
+# expect: undefined
+# expect: 1
+# expect: 5
+# expect: 20
+# The value of .MAKE.JOBS is the exact text given in the command line, not the
+# canonical number.  This doesn't have practical consequences though.
+# expect: 00000000000000000000000000000001

Index: src/usr.bin/make/unit-tests/depsrc-meta.mk
diff -u src/usr.bin/make/unit-tests/depsrc-meta.mk:1.5 src/usr.bin/make/unit-tests/depsrc-meta.mk:1.6
--- src/usr.bin/make/unit-tests/depsrc-meta.mk:1.5	Wed Jan 26 22:19:25 2022
+++ src/usr.bin/make/unit-tests/depsrc-meta.mk	Wed Jan 26 22:47:03 2022
@@ -1,4 +1,4 @@
-# $NetBSD: depsrc-meta.mk,v 1.5 2022/01/26 22:19:25 rillig Exp $
+# $NetBSD: depsrc-meta.mk,v 1.6 2022/01/26 22:47:03 rillig Exp $
 #
 # Tests for the special source .META in dependency declarations.
 
@@ -18,10 +18,13 @@ depsrc-meta-target: .META
 	@rm -f ${.TARGET}-file
 
 check-results:
-	@echo 'Targets from meta mode:'
+	@echo 'Targets from meta mode${.MAKE.JOBS:D in jobs mode}:'
 	@awk '/^TARGET/ { print "| " $$0 }' depsrc-meta-target.meta
 	@rm depsrc-meta-target.meta
 
 all:
-	@${MAKE} -f ${MAKEFILE} actual-test
-	@${MAKE} -f ${MAKEFILE} check-results
+	@${MAKE} -r -f ${MAKEFILE} actual-test
+	@${MAKE} -r -f ${MAKEFILE} check-results
+
+	@${MAKE} -r -f ${MAKEFILE} actual-test -j1
+	@${MAKE} -r -f ${MAKEFILE} check-results -j1

Index: src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp:1.1	Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp	Wed Jan 26 22:47:03 2022
@@ -1 +1,8 @@
+undefined
+1
+--- echo ---
+5
+--- echo ---
+20
+00000000000000000000000000000001
 exit status 0

Reply via email to