| @@ -1,88 +1,90 @@ | | | @@ -1,88 +1,90 @@ |
1 | # $NetBSD: opt-keep-going-indirect.mk,v 1.1 2022/02/12 13:17:57 rillig Exp $ | | 1 | # $NetBSD: opt-keep-going-indirect.mk,v 1.2 2022/02/12 20:05:36 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 | # a 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 |
15 | # compat mode is 1, while jobs mode and indirect failures still return | | 15 | # compat mode is the correct 1, while jobs mode and indirect failures |
16 | # exit status 0. The number of empty lines between the various error | | 16 | # still return the wrong exit status 0. The number of empty lines |
17 | # messages differs between the modes, for no reason. | | 17 | # between the various error messages differs between the modes, for no |
| | | 18 | # reason. |
18 | # | | 19 | # |
19 | # At 2006.11.17.22.07.39, the exit status for direct failures in both | | 20 | # At 2006.11.17.22.07.39, the exit status for direct failures in both |
20 | # modes and for indirect failures in jobs mode was corrected, leaving | | 21 | # modes and for indirect failures in jobs mode was fixed to the correct |
21 | # only indirect failures in compat mode wrong. On the downside, a | | 22 | # 1. The exit status for indirect failures in compat mode is still the |
22 | # failed indirect target in jobs mode was no longer listed as "not | | 23 | # wrong 0. On the downside, a failed indirect target in jobs mode is no |
23 | # remade because of errors". | | 24 | # longer listed as "not remade because of errors". |
24 | # | | 25 | # |
25 | # At 2016.08.26.23.28.39, the additional empty lines for a direct | | 26 | # At 2016.08.26.23.28.39, the additional empty line for a direct failure |
26 | # failure in compat mode was removed, making it consistent with a direct | | 27 | # in compat mode was removed, making it consistent with a direct failure |
27 | # failure in jobs mode. This left only one inconsistency, in that | | 28 | # in jobs mode. This left only one inconsistency, in that indirect |
28 | # indirect failures in jobs mode (by far the most common when building | | 29 | # failures in jobs mode (by far the most common when building large |
29 | # large projects) did not produce any empty line. | | 30 | # projects) did not produce any empty line. |
30 | # | | 31 | # |
31 | # Since 2020.12.07.00.53.30, the exit status is consistently 1 for | | 32 | # Since 2020.12.07.00.53.30, the exit status is consistently 1 for |
32 | # failures in all 4 modes. | | 33 | # failures in all 4 modes. |
33 | # | | 34 | # |
34 | # Bugs: | | 35 | # Bugs: |
35 | # The output in case of a failure needlessly differs between compat and | | 36 | # The output in case of a failure needlessly differs between compat and |
36 | # jobs mode. As of 2022-02-12, compat mode outputs '(continuing)' while | | 37 | # jobs mode. As of 2022-02-12, compat mode outputs '(continuing)' while |
37 | # jobs mode doesn't. In compat mode, the output does not mention which | | 38 | # jobs mode doesn't. In compat mode, the output does not mention which |
38 | # target failed. | | 39 | # target failed. |
39 | # | | 40 | # |
40 | # See also: | | 41 | # See also: |
41 | # https://gnats.netbsd.org/49720 | | 42 | # https://gnats.netbsd.org/49720 |
42 | | | 43 | |
43 | .PHONY: all direct indirect | | 44 | .PHONY: all direct indirect |
44 | | | 45 | |
45 | # 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 |
46 | # default. | | 47 | # default. |
47 | # 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 |
48 | # to the child processes. | | 49 | # to the child processes. |
49 | all: | | 50 | all: |
50 | @echo 'direct compat' | | 51 | @echo 'direct compat' |
51 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?" | | 52 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?" |
52 | @echo | | 53 | @echo |
53 | | | 54 | |
54 | @echo 'direct jobs' | | 55 | @echo 'direct jobs' |
55 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?" | | 56 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?" |
56 | @echo | | 57 | @echo |
57 | | | 58 | |
58 | @echo 'indirect compat' | | 59 | @echo 'indirect compat' |
59 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?" | | 60 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?" |
60 | @echo | | 61 | @echo |
61 | | | 62 | |
62 | @echo 'indirect jobs' | | 63 | @echo 'indirect jobs' |
63 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?" | | 64 | @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?" |
64 | @echo | | 65 | @echo |
65 | | | 66 | |
66 | indirect: direct | | 67 | indirect: direct |
67 | direct: | | 68 | direct: |
68 | false | | 69 | false |
69 | | | 70 | |
70 | # 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. |
71 | # expect: direct compat | | 72 | # expect: direct compat |
72 | # expect: *** Error code 1 (continuing) | | 73 | # expect: *** Error code 1 (continuing) |
73 | # expect: exited 1 | | 74 | # expect: exited 1 |
74 | | | 75 | |
75 | # TODO: Add '(continuing)'. | | 76 | # TODO: Add '(continuing)'. |
76 | # expect: direct jobs | | 77 | # expect: direct jobs |
77 | # expect: *** [direct] Error code 1 | | 78 | # expect: *** [direct] Error code 1 |
78 | # expect: exited 1 | | 79 | # expect: exited 1 |
79 | | | 80 | |
80 | # TODO: Mention the target that failed, maybe even the chain of targets. | | 81 | # TODO: Mention the target that failed, maybe even the chain of targets. |
81 | # expect: indirect compat | | 82 | # expect: indirect compat |
82 | # expect: *** Error code 1 (continuing) | | 83 | # expect: *** Error code 1 (continuing) |
83 | # expect: exited 1 | | 84 | # expect: exited 1 |
84 | | | 85 | |
85 | # TODO: Add '(continuing)'. | | 86 | # TODO: Add '(continuing)'. |
| | | 87 | # TODO: Add 'not remade because of errors'. |
86 | # expect: indirect jobs | | 88 | # expect: indirect jobs |
87 | # expect: *** [direct] Error code 1 | | 89 | # expect: *** [direct] Error code 1 |
88 | # expect: exited 1 | | 90 | # expect: exited 1 |