Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests tests/make: demonstrate unhelpful de...



details:   https://anonhg.NetBSD.org/src/rev/462c62a268fd
branches:  trunk
changeset: 1026531:462c62a268fd
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 27 23:56:11 2021 +0000

description:
tests/make: demonstrate unhelpful debug log in case of errors

The releng build job that runs lint fails.  It outputs the usage message
of lint, which doesn't include the failing option.  After that, make
outputs:

        *** Failed target: lint-cgdconfig
        *** Failed commands:
                ${LINT} ${LINTFLAGS} \
                    ${_LDFLAGS.${:Ucgdconfig}:C/-L[  ]*/-L/Wg:M-L*} \
                    ${LOBJS.${:Ucgdconfig}} ${_LDADD.${:Ucgdconfig}}

Make doesn't output the expanded command, therefore the log doesn't show
the offending option '-pthread' that leads to the usage message.

diffstat:

 usr.bin/make/unit-tests/opt-debug-errors-jobs.exp |   7 +++++++
 usr.bin/make/unit-tests/opt-debug-errors-jobs.mk  |  14 +++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)

diffs (47 lines):

diff -r 237f9b68c3a2 -r 462c62a268fd usr.bin/make/unit-tests/opt-debug-errors-jobs.exp
--- a/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp Sat Nov 27 23:22:25 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp Sat Nov 27 23:56:11 2021 +0000
@@ -45,4 +45,11 @@
 *** [fail-multiline-intention] Error code 1
 
 make: stopped in unit-tests
+
+*** Failed target: fail-vars
+*** Failed commands:
+       @${COMPILE_C} ${COMPILE_C_FLAGS}
+*** [fail-vars] Error code 1
+
+make: stopped in unit-tests
 exit status 1
diff -r 237f9b68c3a2 -r 462c62a268fd usr.bin/make/unit-tests/opt-debug-errors-jobs.mk
--- a/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk  Sat Nov 27 23:22:25 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk  Sat Nov 27 23:56:11 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-errors-jobs.mk,v 1.1 2021/04/27 16:20:06 rillig Exp $
+# $NetBSD: opt-debug-errors-jobs.mk,v 1.2 2021/11/27 23:56:11 rillig Exp $
 #
 # Tests for the -de command line option, which adds debug logging for
 # failed commands and targets; since 2021-04-27 also in jobs mode.
@@ -10,6 +10,7 @@
 all: fail-newline
 all: fail-multiline
 all: fail-multiline-intention
+all: fail-vars
 
 fail-spaces:
        echo '3   spaces'; false
@@ -34,3 +35,14 @@
 fail-multiline-intention:
        echo    'word1'                                                 \
                'word2'; false
+
+# In makefiles that rely heavily on abstracted variables, it is not possible
+# to determine the actual command from the unexpanded command alone. To help
+# debugging these issues (for example in NetBSD's build.sh), output the
+# expanded command as well whenever it differs from the unexpanded command.
+# Since 2021-11-28.
+COMPILE_C=     false c-compiler
+COMPILE_C_DEFS=        macro="several words"
+COMPILE_C_FLAGS=flag1 ${COMPILE_C_DEFS:@def@-${def}@}
+fail-vars:
+       @${COMPILE_C} ${COMPILE_C_FLAGS}



Home | Main Index | Thread Index | Old Index