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): make test for .INCLUDEDFROM...



details:   https://anonhg.NetBSD.org/src/rev/8663407cb070
branches:  trunk
changeset: 1013781:8663407cb070
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 05 16:59:19 2020 +0000

description:
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.

diffstat:

 usr.bin/make/unit-tests/include-main.exp  |  10 +++++-----
 usr.bin/make/unit-tests/include-main.mk   |  17 ++++++-----------
 usr.bin/make/unit-tests/include-sub.mk    |  12 +++++-------
 usr.bin/make/unit-tests/include-subsub.mk |   6 +++---
 4 files changed, 19 insertions(+), 26 deletions(-)

diffs (92 lines):

diff -r 00dfd4d47fdb -r 8663407cb070 usr.bin/make/unit-tests/include-main.exp
--- a/usr.bin/make/unit-tests/include-main.exp  Sat Sep 05 16:44:54 2020 +0000
+++ b/usr.bin/make/unit-tests/include-main.exp  Sat Sep 05 16:59:19 2020 +0000
@@ -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
diff -r 00dfd4d47fdb -r 8663407cb070 usr.bin/make/unit-tests/include-main.mk
--- a/usr.bin/make/unit-tests/include-main.mk   Sat Sep 05 16:44:54 2020 +0000
+++ b/usr.bin/make/unit-tests/include-main.mk   Sat Sep 05 16:59:19 2020 +0000
@@ -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
diff -r 00dfd4d47fdb -r 8663407cb070 usr.bin/make/unit-tests/include-sub.mk
--- a/usr.bin/make/unit-tests/include-sub.mk    Sat Sep 05 16:44:54 2020 +0000
+++ b/usr.bin/make/unit-tests/include-sub.mk    Sat Sep 05 16:59:19 2020 +0000
@@ -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
diff -r 00dfd4d47fdb -r 8663407cb070 usr.bin/make/unit-tests/include-subsub.mk
--- a/usr.bin/make/unit-tests/include-subsub.mk Sat Sep 05 16:44:54 2020 +0000
+++ b/usr.bin/make/unit-tests/include-subsub.mk Sat Sep 05 16:59:19 2020 +0000
@@ -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



Home | Main Index | Thread Index | Old Index