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): add test for off-by-one bug...



details:   https://anonhg.NetBSD.org/src/rev/bd52852155dd
branches:  trunk
changeset: 977743:bd52852155dd
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 31 22:55:35 2020 +0000

description:
make(1): add test for off-by-one bug in ParseTrackInput

diffstat:

 usr.bin/make/unit-tests/directive-include.exp |   6 ++++++
 usr.bin/make/unit-tests/directive-include.mk  |  27 ++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)

diffs (49 lines):

diff -r b1299f0a5aed -r bd52852155dd usr.bin/make/unit-tests/directive-include.exp
--- a/usr.bin/make/unit-tests/directive-include.exp     Sat Oct 31 22:43:01 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-include.exp     Sat Oct 31 22:55:35 2020 +0000
@@ -1,1 +1,7 @@
+CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
+lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
+CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
+lhs = "directive-include.mk null null", rhs = "directive-include.mk null null", op = !=
+CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
+lhs = "directive-include.mk null null", rhs = "directive-include.mk null null", op = !=
 exit status 0
diff -r b1299f0a5aed -r bd52852155dd usr.bin/make/unit-tests/directive-include.mk
--- a/usr.bin/make/unit-tests/directive-include.mk      Sat Oct 31 22:43:01 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-include.mk      Sat Oct 31 22:55:35 2020 +0000
@@ -1,8 +1,33 @@
-# $NetBSD: directive-include.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.2 2020/10/31 22:55:35 rillig Exp $
 #
 # Tests for the .include directive, which includes another file.
 
 # TODO: Implementation
 
+.MAKEFLAGS: -dc
+
+# All included files are recorded in the variable .MAKE.MAKEFILES.
+# In this test, only the basenames of the files are compared since
+# the directories can differ.
+.include "/dev/null"
+.if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
+.  error
+.endif
+
+# Each file is recorded only once in the variable .MAKE.MAKEFILES.
+# XXX: As of 2020-10-31, the very last file can be repeated, due to an
+# off-by-one bug in ParseTrackInput.
+.include "/dev/null"
+.if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
+.  error
+.endif
+
+# Since the file /dev/null is not only recorded at the very end of the
+# variable .MAKE.MAKEFILES, it is not added a third time.
+.include "/dev/null"
+.if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
+.  error
+.endif
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index