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