Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): add test for wrong exit status 0 after...



details:   https://anonhg.NetBSD.org/src/rev/95374c7e6713
branches:  trunk
changeset: 978917:95374c7e6713
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 07 01:32:04 2020 +0000

description:
make(1): add test for wrong exit status 0 after failed targets with -k

diffstat:

 usr.bin/make/compat.c                               |   5 +++--
 usr.bin/make/unit-tests/Makefile                    |   3 ++-
 usr.bin/make/unit-tests/opt-keep-going-multiple.exp |   7 +++++++
 usr.bin/make/unit-tests/opt-keep-going-multiple.mk  |  21 +++++++++++++++++++++
 4 files changed, 33 insertions(+), 3 deletions(-)

diffs (79 lines):

diff -r 08c927719163 -r 95374c7e6713 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Dec 07 01:27:08 2020 +0000
+++ b/usr.bin/make/compat.c     Mon Dec 07 01:32:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.202 2020/12/07 01:10:03 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.203 2020/12/07 01:32:04 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.202 2020/12/07 01:10:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.203 2020/12/07 01:32:04 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -721,6 +721,7 @@
        /*
         * XXX: what about multiple main targets if the first few fail but
         * the last one succeeds?  This should not count as overall success.
+        * See opt-keep-going-multiple.mk.
         */
        if (GNode_IsError(gn))
                seenError = TRUE;
diff -r 08c927719163 -r 95374c7e6713 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Mon Dec 07 01:27:08 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Mon Dec 07 01:32:04 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.237 2020/12/06 21:22:04 rillig Exp $
+# $NetBSD: Makefile,v 1.238 2020/12/07 01:32:04 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -237,6 +237,7 @@
 TESTS+=                opt-jobs
 TESTS+=                opt-jobs-internal
 TESTS+=                opt-keep-going
+TESTS+=                opt-keep-going-multiple
 TESTS+=                opt-m-include-dir
 TESTS+=                opt-no-action
 TESTS+=                opt-no-action-at-all
diff -r 08c927719163 -r 95374c7e6713 usr.bin/make/unit-tests/opt-keep-going-multiple.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/opt-keep-going-multiple.exp       Mon Dec 07 01:32:04 2020 +0000
@@ -0,0 +1,7 @@
+false fail1
+*** Error code 1 (continuing)
+false fail2
+*** Error code 1 (continuing)
+true succeed
+: The end.
+exit status 0
diff -r 08c927719163 -r 95374c7e6713 usr.bin/make/unit-tests/opt-keep-going-multiple.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/opt-keep-going-multiple.mk        Mon Dec 07 01:32:04 2020 +0000
@@ -0,0 +1,21 @@
+# $NetBSD: opt-keep-going-multiple.mk,v 1.1 2020/12/07 01:32:04 rillig Exp $
+#
+# Tests for the -k command line option, which stops building a target as soon
+# as an error is detected, but continues building the other, independent
+# targets, as far as possible.
+#
+# Until 2020-12-07, the exit status of make depended only on the last of the
+# main targets.  Even if the first few targets could not be made, make
+# nevertheless exited with status 0.
+
+.MAKEFLAGS: -k
+.MAKEFLAGS: fail1 fail2 succeed
+
+fail1 fail2: .PHONY
+       false ${.TARGET}
+
+succeed: .PHONY
+       true ${.TARGET}
+
+.END:
+       : The end.



Home | Main Index | Thread Index | Old Index