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 tests/make: rename var-class to var-...
details: https://anonhg.NetBSD.org/src/rev/ab60d7f538a1
branches: trunk
changeset: 359798:ab60d7f538a1
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 23 16:25:53 2022 +0000
description:
tests/make: rename var-class to var-scope
There is no such concept as a "variable class" in make, these tests
focus on the variable scope instead.
diffstat:
distrib/sets/lists/tests/mi | 38 ++++++---
usr.bin/make/unit-tests/Makefile | 14 +-
usr.bin/make/unit-tests/var-class-cmdline.exp | 4 -
usr.bin/make/unit-tests/var-class-cmdline.mk | 80 ----------------------
usr.bin/make/unit-tests/var-class-env.exp | 1 -
usr.bin/make/unit-tests/var-class-env.mk | 8 --
usr.bin/make/unit-tests/var-class-global.exp | 1 -
usr.bin/make/unit-tests/var-class-global.mk | 18 ----
usr.bin/make/unit-tests/var-class-local-legacy.exp | 1 -
usr.bin/make/unit-tests/var-class-local-legacy.mk | 8 --
usr.bin/make/unit-tests/var-class-local.exp | 5 -
usr.bin/make/unit-tests/var-class-local.mk | 45 ------------
usr.bin/make/unit-tests/var-class.exp | 1 -
usr.bin/make/unit-tests/var-class.mk | 9 --
usr.bin/make/unit-tests/var-scope-cmdline.exp | 4 +
usr.bin/make/unit-tests/var-scope-cmdline.mk | 80 ++++++++++++++++++++++
usr.bin/make/unit-tests/var-scope-env.exp | 1 +
usr.bin/make/unit-tests/var-scope-env.mk | 8 ++
usr.bin/make/unit-tests/var-scope-global.exp | 1 +
usr.bin/make/unit-tests/var-scope-global.mk | 18 ++++
usr.bin/make/unit-tests/var-scope-local-legacy.exp | 1 +
usr.bin/make/unit-tests/var-scope-local-legacy.mk | 8 ++
usr.bin/make/unit-tests/var-scope-local.exp | 5 +
usr.bin/make/unit-tests/var-scope-local.mk | 45 ++++++++++++
usr.bin/make/unit-tests/var-scope.exp | 1 +
usr.bin/make/unit-tests/var-scope.mk | 9 ++
26 files changed, 213 insertions(+), 201 deletions(-)
diffs (truncated from 545 to 300 lines):
diff -r 8f92776448d1 -r ab60d7f538a1 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Jan 23 16:09:38 2022 +0000
+++ b/distrib/sets/lists/tests/mi Sun Jan 23 16:25:53 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1183 2022/01/23 16:09:38 rillig Exp $
+# $NetBSD: mi,v 1.1184 2022/01/23 16:25:53 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5931,18 +5931,18 @@
./usr/tests/usr.bin/make/unit-tests/unexport.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/use-inference.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/use-inference.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-cmdline.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-cmdline.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-env.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-env.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-global.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-global.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-local-legacy.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-local-legacy.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-local.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class-local.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/var-class.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-cmdline.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-cmdline.mk tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-env.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-env.mk tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-global.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-global.mk tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-local-legacy.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-local-legacy.mk tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-local.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class-local.mk tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/var-class.mk tests-obsolete obsolete,atf
./usr/tests/usr.bin/make/unit-tests/var-eval-short.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/var-eval-short.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/var-op-append.exp tests-usr.bin-tests compattestfile,atf
@@ -5961,6 +5961,18 @@
./usr/tests/usr.bin/make/unit-tests/var-op.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/var-recursive.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/var-recursive.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-cmdline.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-cmdline.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-env.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-env.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-global.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-global.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-local-legacy.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-local-legacy.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-local.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope-local.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/var-scope.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varcmd.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varcmd.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/vardebug.exp tests-usr.bin-tests compattestfile,atf
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sun Jan 23 16:09:38 2022 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sun Jan 23 16:25:53 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.298 2022/01/23 16:09:38 rillig Exp $
+# $NetBSD: Makefile,v 1.299 2022/01/23 16:25:54 rillig Exp $
#
# Unit tests for make(1)
#
@@ -320,12 +320,12 @@
TESTS+= unexport
TESTS+= unexport-env
TESTS+= use-inference
-TESTS+= var-class
-TESTS+= var-class-cmdline
-TESTS+= var-class-env
-TESTS+= var-class-global
-TESTS+= var-class-local
-TESTS+= var-class-local-legacy
+TESTS+= var-scope
+TESTS+= var-scope-cmdline
+TESTS+= var-scope-env
+TESTS+= var-scope-global
+TESTS+= var-scope-local
+TESTS+= var-scope-local-legacy
TESTS+= var-eval-short
TESTS+= var-op
TESTS+= var-op-append
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-cmdline.exp
--- a/usr.bin/make/unit-tests/var-class-cmdline.exp Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-make: "var-class-cmdline.mk" line 67: global
-make: "var-class-cmdline.mk" line 76: makeflags
-makeflags
-exit status 0
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-cmdline.mk
--- a/usr.bin/make/unit-tests/var-class-cmdline.mk Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-# $NetBSD: var-class-cmdline.mk,v 1.5 2021/02/23 21:59:31 rillig Exp $
-#
-# Tests for variables specified on the command line.
-#
-# Variables that are specified on the command line override those from the
-# global scope.
-#
-# For performance reasons, the actual implementation is more complex than the
-# above single-sentence rule, in order to avoid unnecessary lookups in scopes,
-# which before var.c 1.586 from 2020-10-25 calculated the hash value of the
-# variable name once for each lookup. Instead, when looking up the value of
-# a variable, the search often starts in the global scope since that is where
-# most of the variables are stored. This conflicts with the statement that
-# variables from the cmdline scope override global variables, since after the
-# common case of finding a variable in the global scope, another lookup would
-# be needed in the cmdline scope to ensure that there is no overriding
-# variable there.
-#
-# Instead of this costly lookup scheme, make implements it in a different
-# way:
-#
-# Whenever a global variable is created, this creation is ignored if
-# there is a cmdline variable of the same name.
-#
-# Whenever a cmdline variable is created, any global variable of the
-# same name is deleted.
-#
-# Whenever a global variable is deleted, nothing special happens.
-#
-# Deleting a cmdline variable is not possible.
-#
-# These 4 rules provide the guarantee that whenever a global variable exists,
-# there cannot be a cmdline variable of the same name. Therefore, after
-# finding a variable in the global scope, no additional lookup is needed in
-# the cmdline scope.
-#
-# The above ruleset provides the same guarantees as the simple rule "cmdline
-# overrides global". Due to an implementation mistake, the actual behavior
-# was not entirely equivalent to the simple rule though. The mistake was
-# that when a cmdline variable with '$$' in its name was added, a global
-# variable was deleted, but not with the exact same name as the cmdline
-# variable. Instead, the name of the global variable was expanded one more
-# time than the name of the cmdline variable. For variable names that didn't
-# have a '$$' in their name, it was implemented correctly all the time.
-#
-# The bug was added in var.c 1.183 on 2013-07-16, when Var_Set called
-# Var_Delete to delete the global variable. Just two months earlier, in var.c
-# 1.174 from 2013-05-18, Var_Delete had started to expand the variable name.
-# Together, these two changes made the variable name be expanded twice in a
-# row. This bug was fixed in var.c 1.835 from 2021-02-22.
-#
-# Another bug was the wrong assumption that "deleting a cmdline variable is
-# not possible". Deleting such a variable has been possible since var.c 1.204
-# from 2016-02-19, when the variable modifier ':@' started to delete the
-# temporary loop variable after finishing the loop. It was probably not
-# intended back then that a side effect of this seemingly simple change was
-# that both global and cmdline variables could now be undefined at will as a
-# side effect of evaluating a variable expression. As of 2021-02-23, this is
-# still possible.
-#
-# Most cmdline variables are set at the very beginning, when parsing the
-# command line arguments. Using the special target '.MAKEFLAGS', it is
-# possible to set cmdline variables at any later time.
-
-# A normal global variable, without any cmdline variable nearby.
-VAR= global
-.info ${VAR}
-
-# The global variable is "overridden" by simply deleting it and then
-# installing the cmdline variable instead. Since there is no obvious way to
-# undefine a cmdline variable, there is no need to remember the old value
-# of the global variable could become visible again.
-#
-# See varmod-loop.mk for a non-obvious way to undefine a cmdline variable.
-.MAKEFLAGS: VAR=makeflags
-.info ${VAR}
-
-# If Var_SetWithFlags should ever forget to delete the global variable,
-# the below line would print "global" instead of the current "makeflags".
-.MAKEFLAGS: -V VAR
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-env.exp
--- a/usr.bin/make/unit-tests/var-class-env.exp Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-exit status 0
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-env.mk
--- a/usr.bin/make/unit-tests/var-class-env.mk Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# $NetBSD: var-class-env.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
-#
-# Tests for variables specified in the process environment.
-
-# TODO: Implementation
-
-all:
- @:;
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-global.exp
--- a/usr.bin/make/unit-tests/var-class-global.exp Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-exit status 0
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-global.mk
--- a/usr.bin/make/unit-tests/var-class-global.mk Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-# $NetBSD: var-class-global.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
-#
-# Tests for global variables, which are the most common variables.
-
-# Global variables can be assigned and appended to.
-GLOBAL= value
-GLOBAL+= addition
-.if ${GLOBAL} != "value addition"
-. error
-.endif
-
-# Global variables can be removed from their scope.
-.undef GLOBAL
-.if defined(GLOBAL)
-. error
-.endif
-
-all: .PHONY
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-local-legacy.exp
--- a/usr.bin/make/unit-tests/var-class-local-legacy.exp Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-exit status 0
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-local-legacy.mk
--- a/usr.bin/make/unit-tests/var-class-local-legacy.mk Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# $NetBSD: var-class-local-legacy.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
-#
-# Tests for legacy target-local variables, such as ${<F} or ${@D}.
-
-# TODO: Implementation
-
-all:
- @:;
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-local.exp
--- a/usr.bin/make/unit-tests/var-class-local.exp Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-: Making var-class-local.c out of nothing.
-: Making var-class-local.o from var-class-local.c.
-: Making basename "var-class-local.o" in "." from "var-class-local.c" in ".".
-: all overwritten
-exit status 0
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class-local.mk
--- a/usr.bin/make/unit-tests/var-class-local.mk Sun Jan 23 16:09:38 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-# $NetBSD: var-class-local.mk,v 1.5 2020/11/05 18:08:39 rillig Exp $
-#
-# Tests for target-local variables, such as ${.TARGET} or $@.
-
-# TODO: Implementation
-
-# Ensure that the name of the variable is exactly the given one.
-# The variable "@" is an alias for ".TARGET", so the implementation might
-# canonicalize these aliases at some point, and that might be surprising.
-# This aliasing happens for single-character variable names like $@ or $<
-# (see VarFind, CanonicalVarname), but not for braced or parenthesized
-# expressions like ${@}, ${.TARGET} ${VAR:Mpattern} (see Var_Parse,
-# ParseVarname).
-.if ${@:L} != "@"
-. error
-.endif
-.if ${.TARGET:L} != ".TARGET"
-. error
-.endif
-.if ${@F:L} != "@F"
-. error
-.endif
-.if ${@D:L} != "@D"
-. error
-.endif
-
-all:
-
-.SUFFIXES: .c .o
-
-var-class-local.c:
- : Making ${.TARGET} out of nothing.
-
-.c.o:
- : Making ${.TARGET} from ${.IMPSRC}.
-
- # The local variables @F, @D, <F, <D are legacy forms.
- # See the manual page for details.
- : Making basename "${@F}" in "${@D}" from "${<F}" in "${<D}".
-
-all: var-class-local.o
- # The ::= modifier overwrites the .TARGET variable in the node
- # 'all', not in the global scope. This can be seen with the -dv
- # option, looking for "all:@ = overwritten".
- : ${.TARGET} ${.TARGET::=overwritten}${.TARGET}
diff -r 8f92776448d1 -r ab60d7f538a1 usr.bin/make/unit-tests/var-class.exp
--- a/usr.bin/make/unit-tests/var-class.exp Sun Jan 23 16:09:38 2022 +0000
Home |
Main Index |
Thread Index |
Old Index