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 tests for .SILENT, .BEG...
details: https://anonhg.NetBSD.org/src/rev/2670b323a833
branches: trunk
changeset: 937978:2670b323a833
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 29 17:34:21 2020 +0000
description:
make(1): add tests for .SILENT, .BEGIN and .END
diffstat:
usr.bin/make/unit-tests/depsrc-silent.exp | 3 +++
usr.bin/make/unit-tests/depsrc-silent.mk | 16 ++++++++++------
usr.bin/make/unit-tests/deptgt-begin.exp | 3 +++
usr.bin/make/unit-tests/deptgt-begin.mk | 13 +++++++++----
usr.bin/make/unit-tests/deptgt-end.exp | 3 +++
usr.bin/make/unit-tests/deptgt-end.mk | 13 +++++++++----
6 files changed, 37 insertions(+), 14 deletions(-)
diffs (88 lines):
diff -r ab358f5cf00e -r 2670b323a833 usr.bin/make/unit-tests/depsrc-silent.exp
--- a/usr.bin/make/unit-tests/depsrc-silent.exp Sat Aug 29 16:47:45 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-silent.exp Sat Aug 29 17:34:21 2020 +0000
@@ -1,1 +1,4 @@
+one
+two
+three
exit status 0
diff -r ab358f5cf00e -r 2670b323a833 usr.bin/make/unit-tests/depsrc-silent.mk
--- a/usr.bin/make/unit-tests/depsrc-silent.mk Sat Aug 29 16:47:45 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-silent.mk Sat Aug 29 17:34:21 2020 +0000
@@ -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
diff -r ab358f5cf00e -r 2670b323a833 usr.bin/make/unit-tests/deptgt-begin.exp
--- a/usr.bin/make/unit-tests/deptgt-begin.exp Sat Aug 29 16:47:45 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-begin.exp Sat Aug 29 17:34:21 2020 +0000
@@ -1,1 +1,4 @@
+: parse time
+: .BEGIN
+: all
exit status 0
diff -r ab358f5cf00e -r 2670b323a833 usr.bin/make/unit-tests/deptgt-begin.mk
--- a/usr.bin/make/unit-tests/deptgt-begin.mk Sat Aug 29 16:47:45 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-begin.mk Sat Aug 29 17:34:21 2020 +0000
@@ -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
diff -r ab358f5cf00e -r 2670b323a833 usr.bin/make/unit-tests/deptgt-end.exp
--- a/usr.bin/make/unit-tests/deptgt-end.exp Sat Aug 29 16:47:45 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end.exp Sat Aug 29 17:34:21 2020 +0000
@@ -1,1 +1,4 @@
+: .BEGIN
+: all
+: .END
exit status 0
diff -r ab358f5cf00e -r 2670b323a833 usr.bin/make/unit-tests/deptgt-end.mk
--- a/usr.bin/make/unit-tests/deptgt-end.mk Sat Aug 29 16:47:45 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end.mk Sat Aug 29 17:34:21 2020 +0000
@@ -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:
- @:;
+ : $@
Home |
Main Index |
Thread Index |
Old Index