Module Name:    src
Committed By:   rillig
Date:           Mon Jul 22 18:11:15 UTC 2024

Modified Files:
        src/usr.bin/make: job.c
        src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk

Log Message:
make: fix exit status for error in .BEGIN/.END prerequisite


To generate a diff of this commit:
cvs rdiff -u -r1.481 -r1.482 src/usr.bin/make/job.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.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/job.c
diff -u src/usr.bin/make/job.c:1.481 src/usr.bin/make/job.c:1.482
--- src/usr.bin/make/job.c:1.481	Sat Jul 20 14:09:27 2024
+++ src/usr.bin/make/job.c	Mon Jul 22 18:11:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.481 2024/07/20 14:09:27 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.482 2024/07/22 18:11:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -141,7 +141,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.481 2024/07/20 14:09:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.482 2024/07/22 18:11:15 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1962,8 +1962,7 @@ JobRun(GNode *targ)
 	}
 #else
 	Compat_Make(targ, targ);
-	/* XXX: Replace with GNode_IsError(gn) */
-	if (targ->made == ERROR) {
+	if (GNode_IsError(targ)) {
 		PrintOnError(targ, "\n\nStop.\n");
 		exit(1);
 	}

Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.exp
diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.13
--- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.12	Mon Jul 22 18:02:51 2024
+++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp	Mon Jul 22 18:11:15 2024
@@ -30,7 +30,11 @@ end begin-direct with status 1
 begin begin-indirect
 (exit 13) # before-begin
 *** Error code 13 (continuing)
-end begin-indirect with status 0
+
+
+Stop.
+make: stopped making "begin-indirect" in unit-tests
+end begin-indirect with status 1
 
 begin end-direct
 (exit 13) # .END
@@ -44,6 +48,10 @@ end end-direct with status 1
 begin end-indirect
 (exit 13) # before-end
 *** Error code 13 (continuing)
-end end-indirect with status 0
+
+
+Stop.
+make: stopped making "end-indirect" in unit-tests
+end end-indirect with status 1
 
 exit status 0

Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.12
--- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.11	Mon Jul 22 18:02:51 2024
+++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk	Mon Jul 22 18:11:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: cmd-errors-jobs.mk,v 1.11 2024/07/22 18:02:51 rillig Exp $
+# $NetBSD: cmd-errors-jobs.mk,v 1.12 2024/07/22 18:11:15 rillig Exp $
 #
 # Demonstrate how errors in expressions affect whether the commands
 # are actually executed in jobs mode.
@@ -76,11 +76,9 @@ before-begin:
 	(exit 13) # $@
 .endif
 # expect: begin begin-indirect
-# TODO: Show the "stopped making" message.
-# expect-not: stopped making "begin-indirect"
 # expect: *** Error code 13 (continuing)
-# TODO: Exit with a non-zero status due to the failed target.
-# expect: end begin-indirect with status 0
+# expect: make: stopped making "begin-indirect" in unit-tests
+# expect: end begin-indirect with status 1
 
 
 .if make(end-direct)
@@ -102,8 +100,6 @@ before-end:
 	(exit 13) # $@
 .endif
 # expect: begin end-indirect
-# TODO: Show the "stopped making" message.
-# expect-not: stopped making "end-indirect"
 # expect: *** Error code 13 (continuing)
-# TODO: Exit with a non-zero status due to the failed target.
-# expect: end end-indirect with status 0
+# expect: make: stopped making "end-indirect" in unit-tests
+# expect: end end-indirect with status 1

Reply via email to