aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varname-dot-make-jobs.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/varname-dot-make-jobs.mk')
-rw-r--r--contrib/bmake/unit-tests/varname-dot-make-jobs.mk27
1 files changed, 23 insertions, 4 deletions
diff --git a/contrib/bmake/unit-tests/varname-dot-make-jobs.mk b/contrib/bmake/unit-tests/varname-dot-make-jobs.mk
index af5eebfe7498..5ed62c180eed 100644
--- a/contrib/bmake/unit-tests/varname-dot-make-jobs.mk
+++ b/contrib/bmake/unit-tests/varname-dot-make-jobs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varname-dot-make-jobs.mk,v 1.3 2022/01/26 22:47:03 rillig Exp $
+# $NetBSD: varname-dot-make-jobs.mk,v 1.5 2023/09/10 16:25:32 sjg Exp $
#
# 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.
@@ -15,10 +15,29 @@ all:
@${MAKE} -r -f ${MAKEFILE} echo -j20
@${MAKE} -r -f ${MAKEFILE} echo -j00000000000000000000000000000001
+.if !make(echo) && ${.MAKE.JOBS.C} == "yes"
+# These results will not be static, we need NCPU
+# to compute expected results.
+all: jC
+
+NCPU!= ${MAKE} -r -f /dev/null -jC -V .MAKE.JOBS
+
+# If -j arg is floating point or ends in C;
+# .MAKE.JOBS is a multiple of _SC_NPROCESSORS_ONLN
+# No news is good news here.
+jCvals ?= 1 1.2 2
+
+jC:
+ @for j in ${jCvals}; do \
+ e=`echo "${NCPU} * $$j" | bc | sed 's/\.[0-9]*//'`; \
+ g=`${MAKE} -r -f /dev/null -V .MAKE.JOBS -j$${j}C`; \
+ test $$g = $$e || echo "$$g != $$e"; \
+ done
+
+.endif
+
# 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
+# expect: 1