Module Name: src
Committed By: rillig
Date: Sat Jan 22 17:10:51 UTC 2022
Modified Files:
src/usr.bin/make/unit-tests: opt-debug-hash.exp opt-debug-hash.mk
opt-where-am-i.exp opt-where-am-i.mk parse.exp parse.mk
varmod-quote-dollar.exp varmod-quote-dollar.mk
Log Message:
tests/make: add a few more tests
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-debug-hash.exp \
src/usr.bin/make/unit-tests/opt-debug-hash.mk \
src/usr.bin/make/unit-tests/opt-where-am-i.exp \
src/usr.bin/make/unit-tests/parse.exp \
src/usr.bin/make/unit-tests/parse.mk \
src/usr.bin/make/unit-tests/varmod-quote-dollar.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-where-am-i.mk \
src/usr.bin/make/unit-tests/varmod-quote-dollar.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/opt-debug-hash.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-hash.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-hash.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-hash.exp:1.1 Sat Sep 5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-hash.exp Sat Jan 22 17:10:51 2022
@@ -1 +1,6 @@
-exit status 0
+make: "opt-debug-hash.mk" line 9: Missing argument for ".error"
+make: Fatal errors encountered -- cannot continueHashTable targets: size=16 numEntries=0 maxchain=0
+HashTable Global variables: size=16 numEntries=23 maxchain=3
+
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-debug-hash.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-hash.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-hash.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-hash.mk:1.1 Sat Sep 5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-hash.mk Sat Jan 22 17:10:51 2022
@@ -1,10 +1,12 @@
-# $NetBSD: opt-debug-hash.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-hash.mk,v 1.2 2022/01/22 17:10:51 rillig Exp $
#
# Tests for the -dh command line option, which adds debug logging for
# hash tables. Even more detailed logging is available by compiling
# make with -DDEBUG_HASH_LOOKUP.
-# TODO: Implementation
+.MAKEFLAGS: -dh
-all:
- @:;
+.error
+
+# FIXME: There is a newline missing between 'continueHashTable'.
+# expect: make: Fatal errors encountered -- cannot continueHashTable targets: size=16 numEntries=0 maxchain=0
Index: src/usr.bin/make/unit-tests/opt-where-am-i.exp
diff -u src/usr.bin/make/unit-tests/opt-where-am-i.exp:1.1 src/usr.bin/make/unit-tests/opt-where-am-i.exp:1.2
--- src/usr.bin/make/unit-tests/opt-where-am-i.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-where-am-i.exp Sat Jan 22 17:10:51 2022
@@ -1 +1,4 @@
+make: Entering directory `/'
+make: Leaving directory `/'
+make: Leaving directory `<curdir>'
exit status 0
Index: src/usr.bin/make/unit-tests/parse.exp
diff -u src/usr.bin/make/unit-tests/parse.exp:1.1 src/usr.bin/make/unit-tests/parse.exp:1.2
--- src/usr.bin/make/unit-tests/parse.exp:1.1 Mon Dec 13 23:38:54 2021
+++ src/usr.bin/make/unit-tests/parse.exp Sat Jan 22 17:10:51 2022
@@ -1,4 +1,5 @@
make: "parse.mk" line 7: Makefile appears to contain unresolved CVS/RCS/??? merge conflicts
+make: "parse.mk" line 14: Makefile appears to contain unresolved CVS/RCS/??? merge conflicts
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/parse.mk
diff -u src/usr.bin/make/unit-tests/parse.mk:1.1 src/usr.bin/make/unit-tests/parse.mk:1.2
--- src/usr.bin/make/unit-tests/parse.mk:1.1 Mon Dec 13 23:38:54 2021
+++ src/usr.bin/make/unit-tests/parse.mk Sat Jan 22 17:10:51 2022
@@ -1,7 +1,14 @@
-# $NetBSD: parse.mk,v 1.1 2021/12/13 23:38:54 rillig Exp $
+# $NetBSD: parse.mk,v 1.2 2022/01/22 17:10:51 rillig Exp $
#
# Test those parts of the parsing that do not belong in any of the other
# categories.
# expect+1: Makefile appears to contain unresolved CVS/RCS/??? merge conflicts
<<<<<< old
+
+# No diagnostic since the following line is parsed as a variable assignment,
+# even though the variable name is empty. See also varname-empty.mk.
+====== middle
+
+# expect+1: Makefile appears to contain unresolved CVS/RCS/??? merge conflicts
+>>>>>> new
Index: src/usr.bin/make/unit-tests/varmod-quote-dollar.exp
diff -u src/usr.bin/make/unit-tests/varmod-quote-dollar.exp:1.1 src/usr.bin/make/unit-tests/varmod-quote-dollar.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-quote-dollar.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-quote-dollar.exp Sat Jan 22 17:10:51 2022
@@ -1 +1,2 @@
+!"#$$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
exit status 0
Index: src/usr.bin/make/unit-tests/opt-where-am-i.mk
diff -u src/usr.bin/make/unit-tests/opt-where-am-i.mk:1.2 src/usr.bin/make/unit-tests/opt-where-am-i.mk:1.3
--- src/usr.bin/make/unit-tests/opt-where-am-i.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-where-am-i.mk Sat Jan 22 17:10:51 2022
@@ -1,8 +1,14 @@
-# $NetBSD: opt-where-am-i.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-where-am-i.mk,v 1.3 2022/01/22 17:10:51 rillig Exp $
#
-# Tests for the -w command line option.
+# Tests for the -w command line option, which outputs the current directory
+# at the beginning and end of running make. This is useful when building
+# large source trees that involve several nested make calls.
-# TODO: Implementation
+# The first "Entering directory" is missing since the below .MAKEFLAGS comes
+# too late for it.
+.MAKEFLAGS: -w
all:
- @:;
+.if ${.CURDIR} != "/"
+ @${MAKE} -r -f ${MAKEFILE:tA} -C /
+.endif
Index: src/usr.bin/make/unit-tests/varmod-quote-dollar.mk
diff -u src/usr.bin/make/unit-tests/varmod-quote-dollar.mk:1.2 src/usr.bin/make/unit-tests/varmod-quote-dollar.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-quote-dollar.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-quote-dollar.mk Sat Jan 22 17:10:51 2022
@@ -1,10 +1,10 @@
-# $NetBSD: varmod-quote-dollar.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-quote-dollar.mk,v 1.3 2022/01/22 17:10:51 rillig Exp $
#
# Tests for the :q variable modifier, which quotes the string for the shell
# and doubles dollar signs, to prevent them from being interpreted by a
# child process of make.
-# TODO: Implementation
+ASCII_CHARS= ${.newline} !"\#$$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
all:
- @:;
+ @${MAKE} -r -f /dev/null CHARS=${ASCII_CHARS:q} -V CHARS