Module Name:    src
Committed By:   rillig
Date:           Fri Nov 27 08:36:11 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: depsrc-meta.exp depsrc-meta.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/depsrc-meta.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-meta.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/depsrc-meta.exp
diff -u src/usr.bin/make/unit-tests/depsrc-meta.exp:1.1 src/usr.bin/make/unit-tests/depsrc-meta.exp:1.2
--- src/usr.bin/make/unit-tests/depsrc-meta.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/depsrc-meta.exp	Fri Nov 27 08:36:10 2020
@@ -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

Index: src/usr.bin/make/unit-tests/depsrc-meta.mk
diff -u src/usr.bin/make/unit-tests/depsrc-meta.mk:1.2 src/usr.bin/make/unit-tests/depsrc-meta.mk:1.3
--- src/usr.bin/make/unit-tests/depsrc-meta.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/depsrc-meta.mk	Fri Nov 27 08:36:11 2020
@@ -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

Reply via email to