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 tests/make: test meta mode in jobs mode



details:   https://anonhg.NetBSD.org/src/rev/d096f574c1a6
branches:  trunk
changeset: 359837:d096f574c1a6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jan 26 22:47:03 2022 +0000

description:
tests/make: test meta mode in jobs mode

diffstat:

 usr.bin/make/unit-tests/depsrc-meta.exp           |   2 +
 usr.bin/make/unit-tests/depsrc-meta.mk            |  11 ++++++---
 usr.bin/make/unit-tests/varname-dot-make-jobs.exp |   7 ++++++
 usr.bin/make/unit-tests/varname-dot-make-jobs.mk  |  24 +++++++++++++++++++---
 4 files changed, 36 insertions(+), 8 deletions(-)

diffs (80 lines):

diff -r df69536664c3 -r d096f574c1a6 usr.bin/make/unit-tests/depsrc-meta.exp
--- a/usr.bin/make/unit-tests/depsrc-meta.exp   Wed Jan 26 22:19:25 2022 +0000
+++ b/usr.bin/make/unit-tests/depsrc-meta.exp   Wed Jan 26 22:47:03 2022 +0000
@@ -2,4 +2,6 @@
 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
diff -r df69536664c3 -r d096f574c1a6 usr.bin/make/unit-tests/depsrc-meta.mk
--- a/usr.bin/make/unit-tests/depsrc-meta.mk    Wed Jan 26 22:19:25 2022 +0000
+++ b/usr.bin/make/unit-tests/depsrc-meta.mk    Wed Jan 26 22:47:03 2022 +0000
@@ -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 @@
        @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
diff -r df69536664c3 -r d096f574c1a6 usr.bin/make/unit-tests/varname-dot-make-jobs.exp
--- a/usr.bin/make/unit-tests/varname-dot-make-jobs.exp Wed Jan 26 22:19:25 2022 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-make-jobs.exp Wed Jan 26 22:47:03 2022 +0000
@@ -1,1 +1,8 @@
+undefined
+1
+--- echo ---
+5
+--- echo ---
+20
+00000000000000000000000000000001
 exit status 0
diff -r df69536664c3 -r d096f574c1a6 usr.bin/make/unit-tests/varname-dot-make-jobs.mk
--- a/usr.bin/make/unit-tests/varname-dot-make-jobs.mk  Wed Jan 26 22:19:25 2022 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-make-jobs.mk  Wed Jan 26 22:47:03 2022 +0000
@@ -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



Home | Main Index | Thread Index | Old Index