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