Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Print -de error information when running multip...
details: https://anonhg.NetBSD.org/src/rev/ea8f9169f440
branches: trunk
changeset: 378890:ea8f9169f440
user: christos <christos%NetBSD.org@localhost>
date: Tue Apr 27 15:21:42 2021 +0000
description:
Print -de error information when running multiple jobs
Problem and patch description from https://reviews.freebsd.org/D29647:
When running `make -de` (without any -j flag) bmake prints which command
failed. However, when using the -j flag the -de flag is ignored. This can
make it rather difficult to determine which command failed in an very
parallel build (especially when combined with the -s flag to avoid
ridiculously large logfiles). For single-threaded builds we can combine
-s with -de to get the failed command but this does not work with -jN
(even with -j1). This patch prints the failed shell script with -de in the
multiple jobs mode as well.
>From Alexander Richardson @ FreeBSD
diffstat:
usr.bin/make/job.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diffs (56 lines):
diff -r 27e63bda3a73 -r ea8f9169f440 usr.bin/make/job.c
--- a/usr.bin/make/job.c Tue Apr 27 15:19:25 2021 +0000
+++ b/usr.bin/make/job.c Tue Apr 27 15:21:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.429 2021/04/16 16:49:27 rillig Exp $ */
+/* $NetBSD: job.c,v 1.430 2021/04/27 15:21:42 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.429 2021/04/16 16:49:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.430 2021/04/27 15:21:42 christos Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -1061,6 +1061,21 @@ JobClosePipes(Job *job)
}
static void
+DebugFailedJob(const Job *job)
+{
+ const ListNode *l;
+
+ if (!DEBUG(ERROR))
+ return;
+
+ debug_printf("\n*** Failed target: %s\n*** Failed commands:\n",
+ job->node->name);
+ for (l = job->node->commands.first; l != NULL; l = l->next) {
+ debug_printf("\t%s\n", (const char *)l->datum);
+ }
+}
+
+static void
JobFinishDoneExitedError(Job *job, int *inout_status)
{
SwitchOutputTo(job->node);
@@ -1071,6 +1086,7 @@ JobFinishDoneExitedError(Job *job, int *
}
#endif
if (!shouldDieQuietly(job->node, -1)) {
+ DebugFailedJob(job);
(void)printf("*** [%s] Error code %d%s\n",
job->node->name, WEXITSTATUS(*inout_status),
job->ignerr ? " (ignored)" : "");
@@ -1103,6 +1119,7 @@ static void
JobFinishDoneSignaled(Job *job, int status)
{
SwitchOutputTo(job->node);
+ DebugFailedJob(job);
(void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status));
if (deleteOnError)
JobDeleteTarget(job->node);
Home |
Main Index |
Thread Index |
Old Index