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): in tests, move command line...
details: https://anonhg.NetBSD.org/src/rev/717e08727ce5
branches: trunk
changeset: 978126:717e08727ce5
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Nov 09 20:50:56 2020 +0000
description:
make(1): in tests, move command line arguments into the test proper
diffstat:
usr.bin/make/unit-tests/Makefile | 16 ++--------------
usr.bin/make/unit-tests/envfirst.mk | 4 +++-
usr.bin/make/unit-tests/opt-ignore.mk | 3 ++-
usr.bin/make/unit-tests/opt-keep-going.mk | 3 ++-
usr.bin/make/unit-tests/opt-no-action.mk | 4 +++-
usr.bin/make/unit-tests/opt-query.mk | 4 +++-
usr.bin/make/unit-tests/opt-var-expanded.mk | 4 +++-
usr.bin/make/unit-tests/opt-var-literal.mk | 4 +++-
usr.bin/make/unit-tests/opt-warnings-as-errors.exp | 4 ++--
usr.bin/make/unit-tests/opt-warnings-as-errors.mk | 4 +++-
usr.bin/make/unit-tests/order.mk | 4 +++-
usr.bin/make/unit-tests/recursive.exp | 4 ++--
usr.bin/make/unit-tests/recursive.mk | 4 +++-
usr.bin/make/unit-tests/sh-leading-plus.mk | 4 +++-
14 files changed, 37 insertions(+), 29 deletions(-)
diffs (224 lines):
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Mon Nov 09 20:50:56 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.194 2020/11/09 20:39:46 rillig Exp $
+# $NetBSD: Makefile,v 1.195 2020/11/09 20:50:56 rillig Exp $
#
# Unit tests for make(1)
#
@@ -392,19 +392,7 @@
# settings FLAGS.test=-dv here, since that is closer to the test code.
FLAGS.cond-func-make= via-cmdline
FLAGS.directive-ifmake= first second
-FLAGS.doterror= # none
-FLAGS.envfirst= -e
-FLAGS.export= # none
-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.sh-leading-plus= -n
+FLAGS.doterror= # none, especially not -k
FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmline-plain'
# Some tests need extra postprocessing.
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/envfirst.mk
--- a/usr.bin/make/unit-tests/envfirst.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/envfirst.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,7 +1,9 @@
-# $NetBSD: envfirst.mk,v 1.3 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: envfirst.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# The -e option makes environment variables stronger than global variables.
+.MAKEFLAGS: -e
+
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-ignore.mk
--- a/usr.bin/make/unit-tests/opt-ignore.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-ignore.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-ignore.mk,v 1.4 2020/10/18 18:12:42 rillig Exp $
+# $NetBSD: opt-ignore.mk,v 1.5 2020/11/09 20:50:56 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
@@ -11,6 +11,7 @@
# failed?
.MAKEFLAGS: -d0 # switch stdout to being line-buffered
+.MAKEFLAGS: -i
all: dependency other
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-keep-going.mk
--- a/usr.bin/make/unit-tests/opt-keep-going.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-keep-going.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: opt-keep-going.mk,v 1.4 2020/10/18 18:12:42 rillig Exp $
+# $NetBSD: opt-keep-going.mk,v 1.5 2020/11/09 20:50:56 rillig Exp $
#
# 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.
.MAKEFLAGS: -d0 # switch stdout to being line-buffered
+.MAKEFLAGS: -k
all: dependency other
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-no-action.mk
--- a/usr.bin/make/unit-tests/opt-no-action.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-no-action.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,9 +1,11 @@
-# $NetBSD: opt-no-action.mk,v 1.3 2020/08/19 05:25:26 rillig Exp $
+# $NetBSD: opt-no-action.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# Tests for the -n command line option, which runs almost no commands.
# It just outputs them, to be inspected by human readers.
# Only commands that are in a .MAKE target or prefixed by '+' are run.
+.MAKEFLAGS: -n
+
# 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
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-query.mk
--- a/usr.bin/make/unit-tests/opt-query.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-query.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-query.mk,v 1.3 2020/08/19 05:13:18 rillig Exp $
+# $NetBSD: opt-query.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# Tests for the -q command line option.
#
@@ -6,6 +6,8 @@
# None of the commands in the targets are run, not even those that are
# prefixed with '+'.
+.MAKEFLAGS: -q
+
# 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
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-var-expanded.mk
--- a/usr.bin/make/unit-tests/opt-var-expanded.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-var-expanded.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,6 +1,8 @@
-# $NetBSD: opt-var-expanded.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
+# $NetBSD: opt-var-expanded.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# Tests for the -v command line option.
+.MAKEFLAGS: -v VAR -v VALUE
+
VAR= other ${VALUE} $$$$
VALUE= value
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-var-literal.mk
--- a/usr.bin/make/unit-tests/opt-var-literal.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-var-literal.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,6 +1,8 @@
-# $NetBSD: opt-var-literal.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
+# $NetBSD: opt-var-literal.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# Tests for the -V command line option.
+.MAKEFLAGS: -V VAR -V VALUE
+
VAR= other ${VALUE} $$$$
VALUE= value
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-warnings-as-errors.exp
--- a/usr.bin/make/unit-tests/opt-warnings-as-errors.exp Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.exp Mon Nov 09 20:50:56 2020 +0000
@@ -1,6 +1,6 @@
-make: "opt-warnings-as-errors.mk" line 5: warning: message 1
+make: "opt-warnings-as-errors.mk" line 7: warning: message 1
make: parsing warnings being treated as errors
-make: "opt-warnings-as-errors.mk" line 6: warning: message 2
+make: "opt-warnings-as-errors.mk" line 8: warning: message 2
parsing continues
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/opt-warnings-as-errors.mk
--- a/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,7 +1,9 @@
-# $NetBSD: opt-warnings-as-errors.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
+# $NetBSD: opt-warnings-as-errors.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# Tests for the -W command line option, which turns warnings into errors.
+.MAKEFLAGS: -W
+
.warning message 1
.warning message 2
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/order.mk
--- a/usr.bin/make/unit-tests/order.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/order.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,10 +1,12 @@
-# $NetBSD: order.mk,v 1.1 2014/08/21 13:44:51 apb Exp $
+# $NetBSD: order.mk,v 1.2 2020/11/09 20:50:56 rillig Exp $
# Test that .ORDER is handled correctly.
# The explicit dependency the.o: the.h will make us examine the.h
# the .ORDER will prevent us building it immediately,
# we should then examine the.c rather than stop.
+.MAKEFLAGS: -j1
+
all: the.o
.ORDER: the.c the.h
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/recursive.exp
--- a/usr.bin/make/unit-tests/recursive.exp Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/recursive.exp Mon Nov 09 20:50:56 2020 +0000
@@ -1,5 +1,5 @@
-make: "recursive.mk" line 34: Unclosed variable "MISSING_PAREN"
-make: "recursive.mk" line 35: Unclosed variable "MISSING_BRACE"
+make: "recursive.mk" line 36: Unclosed variable "MISSING_PAREN"
+make: "recursive.mk" line 37: Unclosed variable "MISSING_BRACE"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/recursive.mk
--- a/usr.bin/make/unit-tests/recursive.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/recursive.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: recursive.mk,v 1.3 2020/10/24 08:50:17 rillig Exp $
+# $NetBSD: recursive.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# In -dL mode, a variable may get expanded before it makes sense.
# This would stop make from doing anything since the "recursive" error
@@ -11,6 +11,8 @@
# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
# GNU Automake.
+.MAKEFLAGS: -dL
+
AM_V_lt= ${am__v_lt_${V}}
am__v_lt_= ${am__v_lt_${AM_DEFAULT_VERBOSITY}}
am__v_lt_0= --silent
diff -r fe847435f608 -r 717e08727ce5 usr.bin/make/unit-tests/sh-leading-plus.mk
--- a/usr.bin/make/unit-tests/sh-leading-plus.mk Mon Nov 09 20:39:46 2020 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-plus.mk Mon Nov 09 20:50:56 2020 +0000
@@ -1,8 +1,10 @@
-# $NetBSD: sh-leading-plus.mk,v 1.3 2020/08/23 14:46:33 rillig Exp $
+# $NetBSD: sh-leading-plus.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
#
# Tests for shell commands preceded by a '+', to run them even if
# the command line option -n is given.
+.MAKEFLAGS: -n
+
all:
@echo 'this command is not run'
@+echo 'this command is run'
Home |
Main Index |
Thread Index |
Old Index