Tue Apr 2 15:05:15 2024 UTC (62d)
tests/make: pass PATH onto child processes

This fixes the tests on some Cygwin variant where the shell does not
initialize the PATH environment variable when it's missing.


(rillig)
diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk

cvs diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk 2022/02/12 20:05:36 1.2
+++ src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk 2024/04/02 15:05:15 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: opt-keep-going-indirect.mk,v 1.2 2022/02/12 20:05:36 rillig Exp $ 1# $NetBSD: opt-keep-going-indirect.mk,v 1.3 2024/04/02 15:05:15 rillig Exp $
2# 2#
3# Tests for the -k command line option, which stops building a target as soon 3# Tests for the -k command line option, which stops building a target as soon
4# as an error is detected, but continues building the other, independent 4# as an error is detected, but continues building the other, independent
5# targets, as far as possible. 5# targets, as far as possible.
6# 6#
7# History: 7# History:
8# In 1993, the exit status for the option '-k' was always 0, even if a 8# In 1993, the exit status for the option '-k' was always 0, even if a
9# direct or an indirect target failed. 9# direct or an indirect target failed.
10# 10#
11# Since 2000.12.30.02.05.21, the word '(continuing)' is missing in jobs 11# Since 2000.12.30.02.05.21, the word '(continuing)' is missing in jobs
12# mode, both for direct as well as indirect targets. 12# mode, both for direct as well as indirect targets.
13# 13#
14# Since 2001.10.16.18.50.12, the exit status for a direct failure in 14# Since 2001.10.16.18.50.12, the exit status for a direct failure in
@@ -39,39 +39,39 @@ @@ -39,39 +39,39 @@
39# target failed. 39# target failed.
40# 40#
41# See also: 41# See also:
42# https://gnats.netbsd.org/49720 42# https://gnats.netbsd.org/49720
43 43
44.PHONY: all direct indirect 44.PHONY: all direct indirect
45 45
46# The 'set +e' was necessary in 2003, when the shell was run with '-e' by 46# The 'set +e' was necessary in 2003, when the shell was run with '-e' by
47# default. 47# default.
48# The 'env -i' prevents that the environment variable MAKEFLAGS is passed down 48# The 'env -i' prevents that the environment variable MAKEFLAGS is passed down
49# to the child processes. 49# to the child processes.
50all: 50all:
51 @echo 'direct compat' 51 @echo 'direct compat'
52 @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?" 52 @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?"
53 @echo 53 @echo
54 54
55 @echo 'direct jobs' 55 @echo 'direct jobs'
56 @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?" 56 @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?"
57 @echo 57 @echo
58 58
59 @echo 'indirect compat' 59 @echo 'indirect compat'
60 @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?" 60 @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?"
61 @echo 61 @echo
62 62
63 @echo 'indirect jobs' 63 @echo 'indirect jobs'
64 @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?" 64 @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?"
65 @echo 65 @echo
66 66
67indirect: direct 67indirect: direct
68direct: 68direct:
69 false 69 false
70 70
71# TODO: Mention the target that failed, maybe even the chain of targets. 71# TODO: Mention the target that failed, maybe even the chain of targets.
72# expect: direct compat 72# expect: direct compat
73# expect: *** Error code 1 (continuing) 73# expect: *** Error code 1 (continuing)
74# expect: exited 1 74# expect: exited 1
75 75
76# TODO: Add '(continuing)'. 76# TODO: Add '(continuing)'.
77# expect: direct jobs 77# expect: direct jobs