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 -df debug ...



details:   https://anonhg.NetBSD.org/src/rev/ffc1e79fcce1
branches:  trunk
changeset: 944531:ffc1e79fcce1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 03 08:29:32 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/opt-debug-for.exp |  21 +++++++++++++++++++++
 usr.bin/make/unit-tests/opt-debug-for.mk  |  21 +++++++++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)

diffs (58 lines):

diff -r e5c0ad83fb16 -r ffc1e79fcce1 usr.bin/make/unit-tests/opt-debug-for.exp
--- a/usr.bin/make/unit-tests/opt-debug-for.exp Sat Oct 03 08:16:53 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-for.exp Sat Oct 03 08:29:32 2020 +0000
@@ -1,1 +1,22 @@
+For: new loop 2
+For: end for 2
+For: end for 1
+For: loop body:
+.  for inner in 1 2
+VAR.${:Ua}${inner}=    value
+.  endfor
+For: end for 1
+For: loop body:
+VAR.${:Ua}${:U1}=      value
+For: loop body:
+VAR.${:Ua}${:U2}=      value
+For: loop body:
+.  for inner in 1 2
+VAR.${:Ub}${inner}=    value
+.  endfor
+For: end for 1
+For: loop body:
+VAR.${:Ub}${:U1}=      value
+For: loop body:
+VAR.${:Ub}${:U2}=      value
 exit status 0
diff -r e5c0ad83fb16 -r ffc1e79fcce1 usr.bin/make/unit-tests/opt-debug-for.mk
--- a/usr.bin/make/unit-tests/opt-debug-for.mk  Sat Oct 03 08:16:53 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-for.mk  Sat Oct 03 08:29:32 2020 +0000
@@ -1,9 +1,26 @@
-# $NetBSD: opt-debug-for.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-for.mk,v 1.2 2020/10/03 08:29:32 rillig Exp $
 #
 # Tests for the -df command line option, which adds debug logging for
 # parsing and evaluating .for loops.
 
-# TODO: Implementation
+.MAKEFLAGS: -df
+
+# XXX: In the debug log, the "new loop 2" appears out of context.
+# There should be a "begin loop 1" before, and all these messages should
+# contain line number information.
+#
+# XXX: The "loop body" should print the nesting level as well.
+#
+# XXX: It is hard to extract any information from the debug log since
+# the "begin" and "end" events are not balanced and the nesting level
+# is not printed consistently.  It would also be helpful to mention the
+# actual substitutions, such as "For 1: outer=b".
+#
+.for outer in a b
+.  for inner in 1 2
+VAR.${outer}${inner}=  value
+.  endfor
+.endfor
 
 all:
        @:;



Home | Main Index | Thread Index | Old Index