Module Name:    src
Committed By:   rillig
Date:           Sat Oct  3 08:29:32 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: opt-debug-for.exp opt-debug-for.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-debug-for.exp \
    src/usr.bin/make/unit-tests/opt-debug-for.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/opt-debug-for.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-for.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-for.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-for.exp:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-for.exp	Sat Oct  3 08:29:32 2020
@@ -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
Index: src/usr.bin/make/unit-tests/opt-debug-for.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-for.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-for.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-for.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-for.mk	Sat Oct  3 08:29:32 2020
@@ -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:
 	@:;

Reply via email to