Module Name: src
Committed By: rillig
Date: Sun Aug 23 14:28:04 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: Makefile opt-ignore.exp opt-ignore.mk
opt-keep-going.exp opt-keep-going.mk opt-var-expanded.exp
opt-var-expanded.mk opt-var-literal.exp opt-var-literal.mk
opt-warnings-as-errors.exp opt-warnings-as-errors.mk
Log Message:
make(1): add tests for the -i -k -v -V -W options
To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-ignore.exp \
src/usr.bin/make/unit-tests/opt-keep-going.exp \
src/usr.bin/make/unit-tests/opt-var-expanded.exp \
src/usr.bin/make/unit-tests/opt-var-literal.exp \
src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-ignore.mk \
src/usr.bin/make/unit-tests/opt-keep-going.mk \
src/usr.bin/make/unit-tests/opt-var-expanded.mk \
src/usr.bin/make/unit-tests/opt-var-literal.mk \
src/usr.bin/make/unit-tests/opt-warnings-as-errors.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.117 src/usr.bin/make/unit-tests/Makefile:1.118
--- src/usr.bin/make/unit-tests/Makefile:1.117 Sun Aug 23 13:50:17 2020
+++ src/usr.bin/make/unit-tests/Makefile Sun Aug 23 14:28:04 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.117 2020/08/23 13:50:17 rillig Exp $
+# $NetBSD: Makefile,v 1.118 2020/08/23 14:28:04 rillig Exp $
#
# Unit tests for make(1)
#
@@ -325,8 +325,13 @@ FLAGS.doterror= # none
FLAGS.envfirst= -e
FLAGS.export= # none
FLAGS.lint= -dL -k
+FLAGS.opt-ignore= -i
+FLAGS.opt-keep-going= -k
FLAGS.opt-no-action= -n
FLAGS.opt-query= -q
+FLAGS.opt-var-expanded= -v VAR -v VALUE
+FLAGS.opt-var-literal= -V VAR -V VALUE
+FLAGS.opt-warnings-as-errors= -W
FLAGS.order= -j1
FLAGS.recursive= -dL
FLAGS.vardebug= -k -dv FROM_CMDLINE=
Index: src/usr.bin/make/unit-tests/opt-ignore.exp
diff -u src/usr.bin/make/unit-tests/opt-ignore.exp:1.1 src/usr.bin/make/unit-tests/opt-ignore.exp:1.2
--- src/usr.bin/make/unit-tests/opt-ignore.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-ignore.exp Sun Aug 23 14:28:04 2020
@@ -1 +1,12 @@
+dependency 1
+dependency 2
+dependency 3
+other 1
+other 2
+main 1
+main 2
+*** Error code 1 (ignored)
+*** Error code 7 (ignored)
+*** Error code 1 (ignored)
+*** Error code 1 (ignored)
exit status 0
Index: src/usr.bin/make/unit-tests/opt-keep-going.exp
diff -u src/usr.bin/make/unit-tests/opt-keep-going.exp:1.1 src/usr.bin/make/unit-tests/opt-keep-going.exp:1.2
--- src/usr.bin/make/unit-tests/opt-keep-going.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-keep-going.exp Sun Aug 23 14:28:04 2020
@@ -1 +1,6 @@
+dependency 1
+other 1
+*** Error code 1 (continuing)
+*** Error code 1 (continuing)
+`all' not remade because of errors.
exit status 0
Index: src/usr.bin/make/unit-tests/opt-var-expanded.exp
diff -u src/usr.bin/make/unit-tests/opt-var-expanded.exp:1.1 src/usr.bin/make/unit-tests/opt-var-expanded.exp:1.2
--- src/usr.bin/make/unit-tests/opt-var-expanded.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-var-expanded.exp Sun Aug 23 14:28:04 2020
@@ -1 +1,3 @@
+other value $$
+value
exit status 0
Index: src/usr.bin/make/unit-tests/opt-var-literal.exp
diff -u src/usr.bin/make/unit-tests/opt-var-literal.exp:1.1 src/usr.bin/make/unit-tests/opt-var-literal.exp:1.2
--- src/usr.bin/make/unit-tests/opt-var-literal.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-var-literal.exp Sun Aug 23 14:28:04 2020
@@ -1 +1,3 @@
+other ${VALUE} $$$$
+value
exit status 0
Index: src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
diff -u src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.1 src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.2
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp Sun Aug 23 14:28:04 2020
@@ -1 +1,7 @@
-exit status 0
+make: "opt-warnings-as-errors.mk" line 5: warning: message 1
+make: parsing warnings being treated as errors
+make: "opt-warnings-as-errors.mk" line 6: warning: message 2
+parsing continues
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-ignore.mk
diff -u src/usr.bin/make/unit-tests/opt-ignore.mk:1.2 src/usr.bin/make/unit-tests/opt-ignore.mk:1.3
--- src/usr.bin/make/unit-tests/opt-ignore.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-ignore.mk Sun Aug 23 14:28:04 2020
@@ -1,8 +1,30 @@
-# $NetBSD: opt-ignore.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-ignore.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
#
-# Tests for the -i command line option.
+# Tests for the -i command line option, which ignores the exit status of the
+# shell commands, and just continues with the next command, even from the same
+# target.
+#
+# Is there a situation in which this option is useful?
+#
+# Why are the "Error code" lines all collected at the bottom of the output
+# file, where they cannot be related to the individual shell commands that
+# failed?
+
+all: dependency other
+
+dependency:
+ @echo dependency 1
+ @false
+ @echo dependency 2
+ @:; exit 7
+ @echo dependency 3
-# TODO: Implementation
+other:
+ @echo other 1
+ @false
+ @echo other 2
all:
- @:;
+ @echo main 1
+ @false
+ @echo main 2
Index: src/usr.bin/make/unit-tests/opt-keep-going.mk
diff -u src/usr.bin/make/unit-tests/opt-keep-going.mk:1.2 src/usr.bin/make/unit-tests/opt-keep-going.mk:1.3
--- src/usr.bin/make/unit-tests/opt-keep-going.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-keep-going.mk Sun Aug 23 14:28:04 2020
@@ -1,8 +1,24 @@
-# $NetBSD: opt-keep-going.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-keep-going.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
#
-# Tests for the -k command line option.
+# Tests for the -k command line option, which stops building a target as soon
+# as an error is detected, but continues building the other, independent
+# targets, as far as possible.
-# TODO: Implementation
+all: dependency other
+
+dependency:
+ @echo dependency 1
+ @false
+ @echo dependency 2
+ @:; exit 7
+ @echo dependency 3
+
+other:
+ @echo other 1
+ @false
+ @echo other 2
all:
- @:;
+ @echo main 1
+ @false
+ @echo main 2
Index: src/usr.bin/make/unit-tests/opt-var-expanded.mk
diff -u src/usr.bin/make/unit-tests/opt-var-expanded.mk:1.2 src/usr.bin/make/unit-tests/opt-var-expanded.mk:1.3
--- src/usr.bin/make/unit-tests/opt-var-expanded.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-var-expanded.mk Sun Aug 23 14:28:04 2020
@@ -1,8 +1,6 @@
-# $NetBSD: opt-var-expanded.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-var-expanded.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
#
# Tests for the -v command line option.
-# TODO: Implementation
-
-all:
- @:;
+VAR= other ${VALUE} $$$$
+VALUE= value
Index: src/usr.bin/make/unit-tests/opt-var-literal.mk
diff -u src/usr.bin/make/unit-tests/opt-var-literal.mk:1.2 src/usr.bin/make/unit-tests/opt-var-literal.mk:1.3
--- src/usr.bin/make/unit-tests/opt-var-literal.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-var-literal.mk Sun Aug 23 14:28:04 2020
@@ -1,8 +1,6 @@
-# $NetBSD: opt-var-literal.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-var-literal.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
#
# Tests for the -V command line option.
-# TODO: Implementation
-
-all:
- @:;
+VAR= other ${VALUE} $$$$
+VALUE= value
Index: src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk
diff -u src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk:1.2 src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk:1.3
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Sun Aug 23 14:28:04 2020
@@ -1,8 +1,11 @@
-# $NetBSD: opt-warnings-as-errors.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-warnings-as-errors.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
#
-# Tests for the -W command line option.
+# Tests for the -W command line option, which turns warnings into errors.
-# TODO: Implementation
+.warning message 1
+.warning message 2
+
+_!= echo 'parsing continues' 1>&2
all:
@:;