diff --git a/usr.bin/make/unit-tests/Makefile b/usr.bin/make/unit-tests/Makefile index 95a179ca80af..71345103feff 100644 --- a/usr.bin/make/unit-tests/Makefile +++ b/usr.bin/make/unit-tests/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.135 2020/09/05 06:36:40 rillig Exp $ +# $NetBSD: Makefile,v 1.136 2020/09/05 12:59:07 rillig Exp $ # # Unit tests for make(1) # @@ -393,6 +393,7 @@ POSTPROC.deptgt-suffixes= \ ${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p' POSTPROC.vardebug= ${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p' POSTPROC.varmod-match-escape= ${TOOL_SED} -n -e '/^Pattern/p' +POSTPROC.varname= ${TOOL_SED} -n -e '/^MAGIC/p' -e '/^ORDER_/p' POSTPROC.varname-dot-shell= \ awk '/\.SHELL/ || /^ParseReadLine/' POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p' diff --git a/usr.bin/make/unit-tests/varname.mk b/usr.bin/make/unit-tests/varname.mk index 9dd965083f3f..5928ee51e1fb 100644 --- a/usr.bin/make/unit-tests/varname.mk +++ b/usr.bin/make/unit-tests/varname.mk @@ -1,8 +1,43 @@ -# $NetBSD: varname.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: varname.mk,v 1.3 2020/09/05 12:59:07 rillig Exp $ # # Tests for special variables, such as .MAKE or .PARSEDIR. -# TODO: Implementation +# These following MAGIC variables have the same hash code, at least with +# the default hashing algorithm, which is the same as in Java. The order +# in which these variables are defined determines the order in which they +# appear in the Hash_Table. New entries are prepended to the bucket lists, +# therefore this test numbers the values in descending order. + +.if defined(ORDER_01) + +MAGIC0a0a0a= 8 +MAGIC0a0a1B= 7 +MAGIC0a1B0a= 6 +MAGIC0a1B1B= 5 +MAGIC1B0a0a= 4 +MAGIC1B0a1B= 3 +MAGIC1B1B0a= 2 +MAGIC1B1B1B= 1 + +all: # nothing + +.elif defined(ORDER_10) + +MAGIC1B1B1B= 8 +MAGIC1B1B0a= 7 +MAGIC1B0a1B= 6 +MAGIC1B0a0a= 5 +MAGIC0a1B1B= 4 +MAGIC0a1B0a= 3 +MAGIC0a0a1B= 2 +MAGIC0a0a0a= 1 + +all: # nothing + +.else all: - @:; + @${.MAKE} -f ${MAKEFILE} -dg1 ORDER_01=yes + @${.MAKE} -f ${MAKEFILE} -dg1 ORDER_10=yes + +.endif