Module Name: src
Committed By: rillig
Date: Wed Aug 19 05:13:18 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: Makefile opt-query.exp opt-query.mk
Log Message:
make(1): add test for the -q option
To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-query.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-query.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/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.100 src/usr.bin/make/unit-tests/Makefile:1.101
--- src/usr.bin/make/unit-tests/Makefile:1.100 Sun Aug 16 20:43:01 2020
+++ src/usr.bin/make/unit-tests/Makefile Wed Aug 19 05:13:18 2020
@@ -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.doterror= # none
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=
Index: src/usr.bin/make/unit-tests/opt-query.exp
diff -u src/usr.bin/make/unit-tests/opt-query.exp:1.1 src/usr.bin/make/unit-tests/opt-query.exp:1.2
--- src/usr.bin/make/unit-tests/opt-query.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-query.exp Wed Aug 19 05:13:18 2020
@@ -1 +1,2 @@
-exit status 0
+command during parsing
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-query.mk
diff -u src/usr.bin/make/unit-tests/opt-query.mk:1.2 src/usr.bin/make/unit-tests/opt-query.mk:1.3
--- src/usr.bin/make/unit-tests/opt-query.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-query.mk Wed Aug 19 05:13:18 2020
@@ -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 '+'.
+
+# 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
-# TODO: Implementation
+# 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.