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 the -i -k -v ...



details:   https://anonhg.NetBSD.org/src/rev/81737dd6ea22
branches:  trunk
changeset: 1013244:81737dd6ea22
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 23 14:28:04 2020 +0000

description:
make(1): add tests for the -i -k -v -V -W options

diffstat:

 usr.bin/make/unit-tests/Makefile                   |   7 ++++-
 usr.bin/make/unit-tests/opt-ignore.exp             |  11 ++++++++
 usr.bin/make/unit-tests/opt-ignore.mk              |  30 +++++++++++++++++++--
 usr.bin/make/unit-tests/opt-keep-going.exp         |   5 +++
 usr.bin/make/unit-tests/opt-keep-going.mk          |  24 ++++++++++++++--
 usr.bin/make/unit-tests/opt-var-expanded.exp       |   2 +
 usr.bin/make/unit-tests/opt-var-expanded.mk        |   8 ++---
 usr.bin/make/unit-tests/opt-var-literal.exp        |   2 +
 usr.bin/make/unit-tests/opt-var-literal.mk         |   8 ++---
 usr.bin/make/unit-tests/opt-warnings-as-errors.exp |   8 +++++-
 usr.bin/make/unit-tests/opt-warnings-as-errors.mk  |   9 ++++--
 11 files changed, 91 insertions(+), 23 deletions(-)

diffs (193 lines):

diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Aug 23 14:28:04 2020 +0000
@@ -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.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=
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-ignore.exp
--- a/usr.bin/make/unit-tests/opt-ignore.exp    Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-ignore.exp    Sun Aug 23 14:28:04 2020 +0000
@@ -1,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
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-ignore.mk
--- a/usr.bin/make/unit-tests/opt-ignore.mk     Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-ignore.mk     Sun Aug 23 14:28:04 2020 +0000
@@ -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, 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?
 #
-# Tests for the -i command line option.
+# 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
 
-# TODO: Implementation
+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
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-keep-going.exp
--- a/usr.bin/make/unit-tests/opt-keep-going.exp        Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-keep-going.exp        Sun Aug 23 14:28:04 2020 +0000
@@ -1,1 +1,6 @@
+dependency 1
+other 1
+*** Error code 1 (continuing)
+*** Error code 1 (continuing)
+`all' not remade because of errors.
 exit status 0
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-keep-going.mk
--- a/usr.bin/make/unit-tests/opt-keep-going.mk Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-keep-going.mk Sun Aug 23 14:28:04 2020 +0000
@@ -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.
+
+all: dependency other
 
-# TODO: Implementation
+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
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-var-expanded.exp
--- a/usr.bin/make/unit-tests/opt-var-expanded.exp      Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-var-expanded.exp      Sun Aug 23 14:28:04 2020 +0000
@@ -1,1 +1,3 @@
+other value $$
+value
 exit status 0
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-var-expanded.mk
--- a/usr.bin/make/unit-tests/opt-var-expanded.mk       Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-var-expanded.mk       Sun Aug 23 14:28:04 2020 +0000
@@ -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
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-var-literal.exp
--- a/usr.bin/make/unit-tests/opt-var-literal.exp       Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-var-literal.exp       Sun Aug 23 14:28:04 2020 +0000
@@ -1,1 +1,3 @@
+other ${VALUE} $$$$
+value
 exit status 0
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-var-literal.mk
--- a/usr.bin/make/unit-tests/opt-var-literal.mk        Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-var-literal.mk        Sun Aug 23 14:28:04 2020 +0000
@@ -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
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-warnings-as-errors.exp
--- a/usr.bin/make/unit-tests/opt-warnings-as-errors.exp        Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.exp        Sun Aug 23 14:28:04 2020 +0000
@@ -1,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
diff -r 00c27b483a41 -r 81737dd6ea22 usr.bin/make/unit-tests/opt-warnings-as-errors.mk
--- a/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Sun Aug 23 14:07:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Sun Aug 23 14:28:04 2020 +0000
@@ -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:
        @:;



Home | Main Index | Thread Index | Old Index