Module Name:    src
Committed By:   rillig
Date:           Sat Sep  5 16:59:20 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: include-main.exp include-main.mk
            include-sub.mk include-subsub.mk

Log Message:
make(1): make test for .INCLUDEDFROMDIR simpler

The .info and .warning directives provide exactly the early expansion
that this test needs.  No more .for for getting a snapshot of a
variable.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/include-main.exp \
    src/usr.bin/make/unit-tests/include-sub.mk \
    src/usr.bin/make/unit-tests/include-subsub.mk
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/include-main.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/include-main.exp
diff -u src/usr.bin/make/unit-tests/include-main.exp:1.1 src/usr.bin/make/unit-tests/include-main.exp:1.2
--- src/usr.bin/make/unit-tests/include-main.exp:1.1	Sun May 17 12:36:26 2020
+++ src/usr.bin/make/unit-tests/include-main.exp	Sat Sep  5 16:59:19 2020
@@ -1,6 +1,6 @@
-main-before-ok
-sub-before-ok
-subsub-ok
-sub-after-fail(include-sub.mk)
-main-after-fail(include-sub.mk)
+make: "include-main.mk" line 12: main-before-ok
+make: "include-sub.mk" line 4: sub-before-ok
+make: "include-subsub.mk" line 4: subsub-ok
+make: "include-sub.mk" line 14: warning: sub-after-fail(include-sub.mk)
+make: "include-main.mk" line 22: warning: main-after-fail(include-sub.mk)
 exit status 0
Index: src/usr.bin/make/unit-tests/include-sub.mk
diff -u src/usr.bin/make/unit-tests/include-sub.mk:1.1 src/usr.bin/make/unit-tests/include-sub.mk:1.2
--- src/usr.bin/make/unit-tests/include-sub.mk:1.1	Sun May 17 12:36:26 2020
+++ src/usr.bin/make/unit-tests/include-sub.mk	Sat Sep  5 16:59:19 2020
@@ -1,17 +1,15 @@
-# $NetBSD: include-sub.mk,v 1.1 2020/05/17 12:36:26 rillig Exp $
+# $NetBSD: include-sub.mk,v 1.2 2020/09/05 16:59:19 rillig Exp $
 
 .if ${.INCLUDEDFROMFILE} == "include-main.mk"
-LOG+=		sub-before-ok
+.  info sub-before-ok
 .else
-LOG+=		sub-before-fail
+.  warning sub-before-fail
 .endif
 
 .include "include-subsub.mk"
 
 .if ${.INCLUDEDFROMFILE} == "include-main.mk"
-LOG+=		sub-after-ok
+.  info sub-after-ok
 .else
-.  for f in ${.INCLUDEDFROMFILE}
-LOG+=		sub-after-fail\(${f:Q}\)
-.  endfor
+.  warning sub-after-fail(${.INCLUDEDFROMFILE})
 .endif
Index: src/usr.bin/make/unit-tests/include-subsub.mk
diff -u src/usr.bin/make/unit-tests/include-subsub.mk:1.1 src/usr.bin/make/unit-tests/include-subsub.mk:1.2
--- src/usr.bin/make/unit-tests/include-subsub.mk:1.1	Sun May 17 12:36:26 2020
+++ src/usr.bin/make/unit-tests/include-subsub.mk	Sat Sep  5 16:59:19 2020
@@ -1,7 +1,7 @@
-# $NetBSD: include-subsub.mk,v 1.1 2020/05/17 12:36:26 rillig Exp $
+# $NetBSD: include-subsub.mk,v 1.2 2020/09/05 16:59:19 rillig Exp $
 
 .if ${.INCLUDEDFROMFILE:T} == "include-sub.mk"
-LOG+=		subsub-ok
+.  info subsub-ok
 .else
-LOG+=		subsub-fail
+.  warning subsub-fail
 .endif

Index: src/usr.bin/make/unit-tests/include-main.mk
diff -u src/usr.bin/make/unit-tests/include-main.mk:1.2 src/usr.bin/make/unit-tests/include-main.mk:1.3
--- src/usr.bin/make/unit-tests/include-main.mk:1.2	Mon Jul 27 20:55:59 2020
+++ src/usr.bin/make/unit-tests/include-main.mk	Sat Sep  5 16:59:19 2020
@@ -1,4 +1,4 @@
-# $NetBSD: include-main.mk,v 1.2 2020/07/27 20:55:59 rillig Exp $
+# $NetBSD: include-main.mk,v 1.3 2020/09/05 16:59:19 rillig Exp $
 #
 # Demonstrates that the .INCLUDEDFROMFILE magic variable does not behave
 # as described in the manual page.
@@ -9,22 +9,17 @@
 #
 
 .if !defined(.INCLUDEDFROMFILE)
-LOG+=		main-before-ok
+.  info main-before-ok
 .else
-.  for f in ${.INCLUDEDFROMFILE}
-LOG+=		main-before-fail\(${f:Q}\)
-.  endfor
+.  warning main-before-fail(${.INCLUDEDFROMFILE})
 .endif
 
 .include "include-sub.mk"
 
 .if !defined(.INCLUDEDFROMFILE)
-LOG+=		main-after-ok
+.  info main-after-ok
 .else
-.  for f in ${.INCLUDEDFROMFILE}
-LOG+=		main-after-fail\(${f:Q}\)
-.  endfor
+.  warning main-after-fail(${.INCLUDEDFROMFILE})
 .endif
 
-all:
-	@printf '%s\n' ${LOG}
+all:	# nothing

Reply via email to