Page MenuHomeFreeBSD

bmake: Also print -de error information when running multiple jobs
AbandonedPublic

Authored by arichardson on Apr 8 2021, 2:41 PM.
Tags
None
Referenced Files
F83402496: D29647.id87040.diff
Fri, May 10, 12:44 AM
Unknown Object (File)
Dec 22 2023, 10:58 PM
Unknown Object (File)
Oct 29 2023, 1:43 PM
Unknown Object (File)
Oct 8 2023, 6:47 AM
Unknown Object (File)
Aug 28 2023, 11:35 AM
Unknown Object (File)
Mar 22 2023, 8:03 AM
Unknown Object (File)
Mar 4 2023, 9:34 PM
Unknown Object (File)
Jan 5 2023, 5:03 AM
Subscribers

Details

Reviewers
sjg
imp
Summary

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.

If we look at the following example makefile:

all:
	echo "Running all"
	if [ a = b ]; then \
	    echo "a = b"; \
	else \
	    echo "a != b"; \
	fi; false

Running make -de gives me the following output

Running all
a != b

*** Failed target:  all
*** Failed command: if [ a = b ]; then echo "a = b"; else echo "a != b"; fi; false
*** Error code 1

Running make -de -j1 before:

Running all
a != b

*** [all] Error code 1

Running make -de -j1

Running all
a != b

*** Failed target:  all
*** Failed commands:
	echo "Running all"
	if [ a = b ]; then  echo "a = b";  else  echo "a != b";  fi; false
*** [all] Error code 1

Since we pass the entire list of command for the target to the shell we
can't determine which of the multiple commands failed, but in most cases
this will be a single compiler command so printing the entire list should
be sufficient to debug the problem and allows me to use -s together with
-jN

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 38414
Build 35303: arc lint + arc unit

Event Timeline

@sjg Should I send this patch somewhere else to get it upstreamed, or is posting it here sufficient?

This looks good to me but your comments to sjg about netbsd upstream should be answered.

This revision is now accepted and ready to land.Apr 9 2021, 1:20 AM

ping @sjg. Is it okay if I commit this here, or should this be done upstream first?

ping @sjg. Is it okay if I commit this here, or should this be done upstream first?

Sorry, was way behind on email. Raising this via tech-toolchain@netbsd.org would be good (pls cc me, since my subscription is currently broken ;-)