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: add a few more tests



details:   https://anonhg.NetBSD.org/src/rev/526a5a3e6369
branches:  trunk
changeset: 359787:526a5a3e6369
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 22 17:10:51 2022 +0000

description:
tests/make: add a few more tests

diffstat:

 usr.bin/make/unit-tests/opt-debug-hash.exp      |   7 ++++++-
 usr.bin/make/unit-tests/opt-debug-hash.mk       |  10 ++++++----
 usr.bin/make/unit-tests/opt-where-am-i.exp      |   3 +++
 usr.bin/make/unit-tests/opt-where-am-i.mk       |  14 ++++++++++----
 usr.bin/make/unit-tests/parse.exp               |   1 +
 usr.bin/make/unit-tests/parse.mk                |   9 ++++++++-
 usr.bin/make/unit-tests/varmod-quote-dollar.exp |   1 +
 usr.bin/make/unit-tests/varmod-quote-dollar.mk  |   6 +++---
 8 files changed, 38 insertions(+), 13 deletions(-)

diffs (112 lines):

diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/opt-debug-hash.exp
--- a/usr.bin/make/unit-tests/opt-debug-hash.exp        Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-hash.exp        Sat Jan 22 17:10:51 2022 +0000
@@ -1,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
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/opt-debug-hash.mk
--- a/usr.bin/make/unit-tests/opt-debug-hash.mk Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-hash.mk Sat Jan 22 17:10:51 2022 +0000
@@ -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
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/opt-where-am-i.exp
--- a/usr.bin/make/unit-tests/opt-where-am-i.exp        Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-where-am-i.exp        Sat Jan 22 17:10:51 2022 +0000
@@ -1,1 +1,4 @@
+make: Entering directory `/'
+make: Leaving directory `/'
+make: Leaving directory `<curdir>'
 exit status 0
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/opt-where-am-i.mk
--- a/usr.bin/make/unit-tests/opt-where-am-i.mk Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-where-am-i.mk Sat Jan 22 17:10:51 2022 +0000
@@ -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
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/parse.exp
--- a/usr.bin/make/unit-tests/parse.exp Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/parse.exp Sat Jan 22 17:10:51 2022 +0000
@@ -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
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/parse.mk
--- a/usr.bin/make/unit-tests/parse.mk  Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/parse.mk  Sat Jan 22 17:10:51 2022 +0000
@@ -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
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/varmod-quote-dollar.exp
--- a/usr.bin/make/unit-tests/varmod-quote-dollar.exp   Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-quote-dollar.exp   Sat Jan 22 17:10:51 2022 +0000
@@ -1,1 +1,2 @@
+!"#$$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
 exit status 0
diff -r 0a0027695a0e -r 526a5a3e6369 usr.bin/make/unit-tests/varmod-quote-dollar.mk
--- a/usr.bin/make/unit-tests/varmod-quote-dollar.mk    Sat Jan 22 16:24:45 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-quote-dollar.mk    Sat Jan 22 17:10:51 2022 +0000
@@ -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



Home | Main Index | Thread Index | Old Index