Module Name:    src
Committed By:   rillig
Date:           Sat Aug 29 17:34:21 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: depsrc-silent.exp depsrc-silent.mk
            deptgt-begin.exp deptgt-begin.mk deptgt-end.exp deptgt-end.mk

Log Message:
make(1): add tests for .SILENT, .BEGIN and .END


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/depsrc-silent.exp \
    src/usr.bin/make/unit-tests/deptgt-begin.exp \
    src/usr.bin/make/unit-tests/deptgt-end.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-silent.mk \
    src/usr.bin/make/unit-tests/deptgt-begin.mk \
    src/usr.bin/make/unit-tests/deptgt-end.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-silent.exp
diff -u src/usr.bin/make/unit-tests/depsrc-silent.exp:1.1 src/usr.bin/make/unit-tests/depsrc-silent.exp:1.2
--- src/usr.bin/make/unit-tests/depsrc-silent.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/depsrc-silent.exp	Sat Aug 29 17:34:21 2020
@@ -1 +1,4 @@
+one
+two
+three
 exit status 0
Index: src/usr.bin/make/unit-tests/deptgt-begin.exp
diff -u src/usr.bin/make/unit-tests/deptgt-begin.exp:1.1 src/usr.bin/make/unit-tests/deptgt-begin.exp:1.2
--- src/usr.bin/make/unit-tests/deptgt-begin.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/deptgt-begin.exp	Sat Aug 29 17:34:21 2020
@@ -1 +1,4 @@
+: parse time
+: .BEGIN
+: all
 exit status 0
Index: src/usr.bin/make/unit-tests/deptgt-end.exp
diff -u src/usr.bin/make/unit-tests/deptgt-end.exp:1.1 src/usr.bin/make/unit-tests/deptgt-end.exp:1.2
--- src/usr.bin/make/unit-tests/deptgt-end.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/deptgt-end.exp	Sat Aug 29 17:34:21 2020
@@ -1 +1,4 @@
+: .BEGIN
+: all
+: .END
 exit status 0

Index: src/usr.bin/make/unit-tests/depsrc-silent.mk
diff -u src/usr.bin/make/unit-tests/depsrc-silent.mk:1.2 src/usr.bin/make/unit-tests/depsrc-silent.mk:1.3
--- src/usr.bin/make/unit-tests/depsrc-silent.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/depsrc-silent.mk	Sat Aug 29 17:34:21 2020
@@ -1,8 +1,12 @@
-# $NetBSD: depsrc-silent.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-silent.mk,v 1.3 2020/08/29 17:34:21 rillig Exp $
 #
-# Tests for the special source .SILENT in dependency declarations.
+# Tests for the special source .SILENT in dependency declarations,
+# which hides the commands, no matter whether they are prefixed with
+# '@' or not.
 
-# TODO: Implementation
-
-all:
-	@:;
+# Without the .SILENT, the commands 'echo one' and 'echo two' would be
+# written to stdout.
+all: .SILENT
+	echo one
+	echo two
+	@echo three
Index: src/usr.bin/make/unit-tests/deptgt-begin.mk
diff -u src/usr.bin/make/unit-tests/deptgt-begin.mk:1.2 src/usr.bin/make/unit-tests/deptgt-begin.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-begin.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-begin.mk	Sat Aug 29 17:34:21 2020
@@ -1,8 +1,13 @@
-# $NetBSD: deptgt-begin.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-begin.mk,v 1.3 2020/08/29 17:34:21 rillig Exp $
 #
-# Tests for the special target .BEGIN in dependency declarations.
+# Tests for the special target .BEGIN in dependency declarations,
+# which is a container for commands that are run before any other
+# commands from the shell lines.
 
-# TODO: Implementation
+.BEGIN:
+	: $@
 
 all:
-	@:;
+	: $@
+
+_!=	echo : parse time 1>&2
Index: src/usr.bin/make/unit-tests/deptgt-end.mk
diff -u src/usr.bin/make/unit-tests/deptgt-end.mk:1.2 src/usr.bin/make/unit-tests/deptgt-end.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-end.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-end.mk	Sat Aug 29 17:34:21 2020
@@ -1,8 +1,13 @@
-# $NetBSD: deptgt-end.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-end.mk,v 1.3 2020/08/29 17:34:21 rillig Exp $
 #
-# Tests for the special target .END in dependency declarations.
+# Tests for the special target .END in dependency declarations,
+# which is run after making the desired targets.
 
-# TODO: Implementation
+.BEGIN:
+	: $@
+
+.END:
+	: $@
 
 all:
-	@:;
+	: $@

Reply via email to