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 very basic test about m...



details:   https://anonhg.NetBSD.org/src/rev/ffa528023f4c
branches:  trunk
changeset: 946425:ffa528023f4c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Nov 27 08:36:10 2020 +0000

description:
make(1): add very basic test about meta mode

This test is just meant to cover the existing code, it still needs to be
cleaned up to serve as a tutorial and to highlight the really
interesting points.

diffstat:

 usr.bin/make/unit-tests/depsrc-meta.exp |   4 ++++
 usr.bin/make/unit-tests/depsrc-meta.mk  |  26 ++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 63236491398e -r ffa528023f4c usr.bin/make/unit-tests/depsrc-meta.exp
--- a/usr.bin/make/unit-tests/depsrc-meta.exp   Fri Nov 27 08:18:14 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-meta.exp   Fri Nov 27 08:36:10 2020 +0000
@@ -1,1 +1,5 @@
+Skipping meta for actual-test: no commands
+Skipping meta for .END: .SPECIAL
+Targets from meta mode:
+| TARGET depsrc-meta-target
 exit status 0
diff -r 63236491398e -r ffa528023f4c usr.bin/make/unit-tests/depsrc-meta.mk
--- a/usr.bin/make/unit-tests/depsrc-meta.mk    Fri Nov 27 08:18:14 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-meta.mk    Fri Nov 27 08:36:10 2020 +0000
@@ -1,8 +1,30 @@
-# $NetBSD: depsrc-meta.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-meta.mk,v 1.3 2020/11/27 08:36:11 rillig Exp $
 #
 # Tests for the special source .META in dependency declarations.
 
 # TODO: Implementation
+# TODO: Explanation
+
+.if make(actual-test)
+
+.MAKEFLAGS: -dM
+.MAKE.MODE=    meta curDirOk=true
+
+actual-test: depsrc-meta-target
+depsrc-meta-target: .META
+       @> ${.TARGET}-file
+       @rm -f ${.TARGET}-file
+
+.elif make(check-results)
+
+check-results:
+       @echo 'Targets from meta mode:'
+       @awk '/^TARGET/ { print "| " $$0 }' depsrc-meta-target.meta
+
+.else
 
 all:
-       @:;
+       @${MAKE} -f ${MAKEFILE} actual-test
+       @${MAKE} -f ${MAKEFILE} check-results
+
+.endif



Home | Main Index | Thread Index | Old Index