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 test for the -q option



details:   https://anonhg.NetBSD.org/src/rev/1fa42722f144
branches:  trunk
changeset: 937438:1fa42722f144
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Aug 19 05:13:18 2020 +0000

description:
make(1): add test for the -q option

diffstat:

 usr.bin/make/unit-tests/Makefile      |   3 ++-
 usr.bin/make/unit-tests/opt-query.exp |   3 ++-
 usr.bin/make/unit-tests/opt-query.mk  |  22 +++++++++++++++++++---
 3 files changed, 23 insertions(+), 5 deletions(-)

diffs (55 lines):

diff -r 48a6c1aec775 -r 1fa42722f144 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Wed Aug 19 02:19:06 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Wed Aug 19 05:13:18 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.100 2020/08/16 20:43:01 rillig Exp $
+# $NetBSD: Makefile,v 1.101 2020/08/19 05:13:18 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -310,6 +310,7 @@
 FLAGS.envfirst=                -e
 FLAGS.export=          # none
 FLAGS.lint=            -dL -k
+FLAGS.opt-query=       -q
 FLAGS.order=           -j1
 FLAGS.recursive=       -dL
 FLAGS.vardebug=                -k -dv FROM_CMDLINE=
diff -r 48a6c1aec775 -r 1fa42722f144 usr.bin/make/unit-tests/opt-query.exp
--- a/usr.bin/make/unit-tests/opt-query.exp     Wed Aug 19 02:19:06 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-query.exp     Wed Aug 19 05:13:18 2020 +0000
@@ -1,1 +1,2 @@
-exit status 0
+command during parsing
+exit status 1
diff -r 48a6c1aec775 -r 1fa42722f144 usr.bin/make/unit-tests/opt-query.mk
--- a/usr.bin/make/unit-tests/opt-query.mk      Wed Aug 19 02:19:06 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-query.mk      Wed Aug 19 05:13:18 2020 +0000
@@ -1,8 +1,24 @@
-# $NetBSD: opt-query.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-query.mk,v 1.3 2020/08/19 05:13:18 rillig Exp $
 #
 # Tests for the -q command line option.
+#
+# The -q option only looks at the dependencies between the targets.
+# None of the commands in the targets are run, not even those that are
+# prefixed with '+'.
 
-# TODO: Implementation
+# This command cannot be prevented from being run since it is used at parse
+# time, and any later variable assignments may depend on its result.
+!=     echo 'command during parsing' 1>&2; echo
 
+# None of these commands are run.
+.BEGIN:
+       @echo '$@: hidden command'
+       @+echo '$@: run always'
+
+# None of these commands are run.
 all:
-       @:;
+       @echo '$@: hidden command'
+       @+echo '$@: run always'
+
+# The exit status 1 is because the "all" target has to be made, that is,
+# it is not up-to-date.



Home | Main Index | Thread Index | Old Index