Module Name:    src
Committed By:   sjg
Date:           Sun Sep 10 16:25:32 UTC 2023

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

Log Message:
make: skip -jC tests unless .MAKE.JOBS.C is yes


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-jobs.mk \
    src/usr.bin/make/unit-tests/varname-dot-make-jobs.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/opt-jobs.mk
diff -u src/usr.bin/make/unit-tests/opt-jobs.mk:1.4 src/usr.bin/make/unit-tests/opt-jobs.mk:1.5
--- src/usr.bin/make/unit-tests/opt-jobs.mk:1.4	Sun Sep 10 11:41:33 2023
+++ src/usr.bin/make/unit-tests/opt-jobs.mk	Sun Sep 10 16:25:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: opt-jobs.mk,v 1.4 2023/09/10 11:41:33 rillig Exp $
+# $NetBSD: opt-jobs.mk,v 1.5 2023/09/10 16:25:32 sjg Exp $
 #
 # Tests for the -j command line option, which creates the targets in parallel.
 
@@ -39,7 +39,7 @@ EXPECT..5e1C=	<integer>		# unlikely to o
 EXPECT.07.5C=	<integer>
 EXPECT.08.5C=	argument '08.5C' to option '-j' must be a positive number (exit 2)
 
-.if ${.MAKE.JOBS.C}
+.if ${.MAKE.JOBS.C} == "yes"
 .  for arg in ${ARGS}
 OUTPUT!=	${MAKE} -r -f /dev/null -j ${arg} -v .MAKE.JOBS 2>&1 || echo "(exit $$?)"
 .    if ${OUTPUT:C,^[0-9]+$,numeric,W} == numeric
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.4 src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.5
--- src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.4	Sat Sep  9 01:30:59 2023
+++ src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk	Sun Sep 10 16:25:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varname-dot-make-jobs.mk,v 1.4 2023/09/09 01:30:59 sjg 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,16 +15,13 @@ all:
 	@${MAKE} -r -f ${MAKEFILE} echo -j20
 	@${MAKE} -r -f ${MAKEFILE} echo -j00000000000000000000000000000001
 
-.if !make(echo)
+.if !make(echo) && ${.MAKE.JOBS.C} == "yes"
 # These results will not be static, we need NCPU
 # to compute expected results.
-# We only support -jC if _SC_NPROCESSORS_ONLN is defined,
-# otherwise we will get NCPU=0
-NCPU!= ${MAKE} -r -f /dev/null -jC -V .MAKE.JOBS 2> /dev/null || echo 0
-
-.if ${NCPU} > 0
 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.
@@ -38,7 +35,6 @@ jC:
 	done
 
 .endif
-.endif
 
 # expect: undefined
 # expect: 1

Reply via email to