Module Name:    src
Committed By:   rillig
Date:           Fri Apr 26 17:11:22 UTC 2024

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

Log Message:
make: in parallel mode, print the directory in which a job failed

When multiple targets run in parallel, the "stopped in" line may be
several lines away from the "Failed target" line, making them hard to
correlate.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/usr.bin/make/job.c
cvs rdiff -u -r1.4 -r1.5 \
    src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp

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.468 src/usr.bin/make/job.c:1.469
--- src/usr.bin/make/job.c:1.468	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/job.c	Fri Apr 26 17:11:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.468 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.469 2024/04/26 17:11:22 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.468 2024/04/20 10:18:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.469 2024/04/26 17:11:22 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1062,6 +1062,7 @@ DebugFailedJob(const Job *job)
 
 	debug_printf("\n");
 	debug_printf("*** Failed target: %s\n", job->node->name);
+	debug_printf("*** In directory: %s\n", curdir);
 	debug_printf("*** Failed commands:\n");
 	for (ln = job->node->commands.first; ln != NULL; ln = ln->next) {
 		const char *cmd = ln->datum;

Index: src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.4 src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.5
--- src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.4	Sun Nov 28 00:02:07 2021
+++ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp	Fri Apr 26 17:11:22 2024
@@ -2,6 +2,7 @@ echo '3   spaces'; false
 3   spaces
 
 *** Failed target: fail-spaces
+*** In directory: <curdir>
 *** Failed commands:
 	echo '3   spaces'; false
 *** [fail-spaces] Error code 1
@@ -11,6 +12,7 @@ echo \  indented; false
   indented
 
 *** Failed target: fail-escaped-space
+*** In directory: <curdir>
 *** Failed commands:
 	echo \  indented; false
 *** [fail-escaped-space] Error code 1
@@ -22,6 +24,7 @@ line1
 line2
 
 *** Failed target: fail-newline
+*** In directory: <curdir>
 *** Failed commands:
 	echo 'line1${.newline}line2'; false
 	=> echo 'line1
@@ -33,6 +36,7 @@ echo 'line1 line2'; false
 line1 line2
 
 *** Failed target: fail-multiline
+*** In directory: <curdir>
 *** Failed commands:
 	echo 'line1 line2'; false
 *** [fail-multiline] Error code 1
@@ -42,6 +46,7 @@ echo	'word1'							 'word2'; false
 word1 word2
 
 *** Failed target: fail-multiline-intention
+*** In directory: <curdir>
 *** Failed commands:
 	echo	'word1'							 'word2'; false
 *** [fail-multiline-intention] Error code 1
@@ -49,6 +54,7 @@ word1 word2
 make: stopped in unit-tests
 
 *** Failed target: fail-vars
+*** In directory: <curdir>
 *** Failed commands:
 	@${COMPILE_C} ${COMPILE_C_FLAGS}
 	=> @false c-compiler flag1 -macro="several words"

Reply via email to