Module Name:    src
Committed By:   rillig
Date:           Mon Dec  7 01:32:05 UTC 2020

Modified Files:
        src/usr.bin/make: compat.c
        src/usr.bin/make/unit-tests: Makefile
Added Files:
        src/usr.bin/make/unit-tests: opt-keep-going-multiple.exp
            opt-keep-going-multiple.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/compat.c
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 \
    src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp \
    src/usr.bin/make/unit-tests/opt-keep-going-multiple.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.202 src/usr.bin/make/compat.c:1.203
--- src/usr.bin/make/compat.c:1.202	Mon Dec  7 01:10:03 2020
+++ src/usr.bin/make/compat.c	Mon Dec  7 01:32:04 2020
@@ -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 @@ Compat_Run(GNodeList *targs)
 	/*
 	 * 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;

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.237 src/usr.bin/make/unit-tests/Makefile:1.238
--- src/usr.bin/make/unit-tests/Makefile:1.237	Sun Dec  6 21:22:04 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Dec  7 01:32:04 2020
@@ -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-include-dir
 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

Added files:

Index: src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp
diff -u /dev/null src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp:1.1
--- /dev/null	Mon Dec  7 01:32:05 2020
+++ src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp	Mon Dec  7 01:32:04 2020
@@ -0,0 +1,7 @@
+false fail1
+*** Error code 1 (continuing)
+false fail2
+*** Error code 1 (continuing)
+true succeed
+: The end.
+exit status 0
Index: src/usr.bin/make/unit-tests/opt-keep-going-multiple.mk
diff -u /dev/null src/usr.bin/make/unit-tests/opt-keep-going-multiple.mk:1.1
--- /dev/null	Mon Dec  7 01:32:05 2020
+++ src/usr.bin/make/unit-tests/opt-keep-going-multiple.mk	Mon Dec  7 01:32:04 2020
@@ -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.

Reply via email to