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 make(1): add test for the -dj debug ...



details:   https://anonhg.NetBSD.org/src/rev/117356c6a423
branches:  trunk
changeset: 940065:117356c6a423
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 03 08:16:53 2020 +0000

description:
make(1): add test for the -dj debug option

diffstat:

 usr.bin/make/unit-tests/Makefile           |   6 +++++-
 usr.bin/make/unit-tests/opt-debug-jobs.exp |  24 ++++++++++++++++++++++++
 usr.bin/make/unit-tests/opt-debug-jobs.mk  |  25 +++++++++++++++++++++----
 3 files changed, 50 insertions(+), 5 deletions(-)

diffs (83 lines):

diff -r 9fa7e42af656 -r 117356c6a423 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sat Oct 03 07:52:30 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sat Oct 03 08:16:53 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.156 2020/10/02 20:34:59 rillig Exp $
+# $NetBSD: Makefile,v 1.157 2020/10/03 08:16:53 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -403,6 +403,10 @@
 SED_CMDS.opt-debug-graph1+= \
                        -e '/Global Variables:/,/Suffixes:/d'
 SED_CMDS.sh-dots=      -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,'
+SED_CMDS.opt-debug-jobs=       -e 's,([0-9][0-9]*),(<pid>),'
+SED_CMDS.opt-debug-jobs+=      -e 's,pid [0-9][0-9]*,pid <pid>,'
+SED_CMDS.opt-debug-jobs+=      -e 's,Process [0-9][0-9]*,Process <pid>,'
+SED_CMDS.opt-debug-jobs+=      -e 's,JobFinish: [0-9][0-9]*,JobFinish: <pid>,'
 SED_CMDS.varmod-subst-regex+= \
                        -e 's,\(Regex compilation error:\).*,\1 (details omitted),'
 SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,'
diff -r 9fa7e42af656 -r 117356c6a423 usr.bin/make/unit-tests/opt-debug-jobs.exp
--- a/usr.bin/make/unit-tests/opt-debug-jobs.exp        Sat Oct 03 07:52:30 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-jobs.exp        Sat Oct 03 08:16:53 2020 +0000
@@ -1,1 +1,25 @@
+job_pipe -1 -1, maxjobs 1, tokens 1, compat 0
+Job_TokenWithdraw(<pid>): aborting 0, running 0
+(<pid>) withdrew token
+echo ": expanded expression"
+{ : expanded expression 
+} || exit $?
+echo ":  variable"
+{ :  variable 
+} || exit $?
+echo ": 'single' and \"double\" quotes"
+{ : 'single' and "double" quotes 
+} || exit $?
+Running all locally
+       Command: sh -q 
+JobExec(all): pid <pid> added to jobs table
+job table @ job started
+job 0, status 3, flags 0, pid <pid>
+: expanded expression
+:  variable
+: 'single' and "double" quotes
+Process <pid> exited/stopped status 0.
+JobFinish: <pid> [all], status 0
+Job_TokenWithdraw(<pid>): aborting 0, running 0
+(<pid>) withdrew token
 exit status 0
diff -r 9fa7e42af656 -r 117356c6a423 usr.bin/make/unit-tests/opt-debug-jobs.mk
--- a/usr.bin/make/unit-tests/opt-debug-jobs.mk Sat Oct 03 07:52:30 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-jobs.mk Sat Oct 03 08:16:53 2020 +0000
@@ -1,9 +1,26 @@
-# $NetBSD: opt-debug-jobs.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-jobs.mk,v 1.2 2020/10/03 08:16:53 rillig Exp $
 #
-# Tests for the -da command line option, which adds debug logging about
+# Tests for the -dj command line option, which adds debug logging about
 # running jobs in multiple shells.
 
-# TODO: Implementation
+.MAKEFLAGS: -dj
+
+# Run in parallel mode since the debug logging is more interesting there
+# than in compat mode.
+.MAKEFLAGS: -j1
 
 all:
-       @:;
+       # Only the actual command is logged.
+       # To see the evaluation of the variable expressions, use -dv.
+       : ${:Uexpanded} expression
+
+       # Undefined variables expand to empty strings.
+       # Multiple spaces are preserved in the command, as they might be
+       # significant.
+       : ${UNDEF} variable
+
+       # In the debug output, single quotes are not escaped, even though
+       # the whole command is enclosed in single quotes as well.
+       # This allows to copy and paste the whole command, without having
+       # to unescape anything.
+       : 'single' and "double" quotes



Home | Main Index | Thread Index | Old Index