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: demonstrate wrong locati...



details:   https://anonhg.NetBSD.org/src/rev/b8b43947a028
branches:  trunk
changeset: 359736:b8b43947a028
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jan 19 22:10:41 2022 +0000

description:
tests/make: demonstrate wrong location in diagnostic (since 2018-12-22)

When a target has multiple places where commands are defined, the
diagnostics mixed up the filename in some cases.

diffstat:

 distrib/sets/lists/tests/mi               |   4 +++-
 usr.bin/make/unit-tests/Makefile          |   3 ++-
 usr.bin/make/unit-tests/dep-duplicate.exp |   4 ++++
 usr.bin/make/unit-tests/dep-duplicate.mk  |  21 +++++++++++++++++++++
 usr.bin/make/unit-tests/dep-wildcards.exp |   1 +
 5 files changed, 31 insertions(+), 2 deletions(-)

diffs (79 lines):

diff -r 481c6e65047c -r b8b43947a028 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Jan 19 13:33:49 2022 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Jan 19 22:10:41 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1181 2021/12/28 00:56:16 rillig Exp $
+# $NetBSD: mi,v 1.1182 2022/01/19 22:10:41 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5455,6 +5455,8 @@
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.mk                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.exp                       tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.mk                                tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-duplicate.exp                          tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-duplicate.mk                           tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.exp                             tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.mk                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-none.exp                               tests-usr.bin-tests     compattestfile,atf
diff -r 481c6e65047c -r b8b43947a028 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Wed Jan 19 13:33:49 2022 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Wed Jan 19 22:10:41 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.295 2022/01/11 19:47:34 rillig Exp $
+# $NetBSD: Makefile,v 1.296 2022/01/19 22:10:41 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -92,6 +92,7 @@
 TESTS+=                dep-colon-bug-cross-file
 TESTS+=                dep-double-colon
 TESTS+=                dep-double-colon-indep
+TESTS+=                dep-duplicate
 TESTS+=                dep-exclam
 TESTS+=                dep-none
 TESTS+=                dep-op-missing
diff -r 481c6e65047c -r b8b43947a028 usr.bin/make/unit-tests/dep-duplicate.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/dep-duplicate.exp Wed Jan 19 22:10:41 2022 +0000
@@ -0,0 +1,4 @@
+make: "dep-duplicate.inc" line 1: warning: duplicate script for target "all" ignored
+make: "dep-duplicate.inc" line 15: warning: using previous script for "all" defined here
+first
+exit status 0
diff -r 481c6e65047c -r b8b43947a028 usr.bin/make/unit-tests/dep-duplicate.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/dep-duplicate.mk  Wed Jan 19 22:10:41 2022 +0000
@@ -0,0 +1,21 @@
+# $NetBSD: dep-duplicate.mk,v 1.1 2022/01/19 22:10:41 rillig Exp $
+#
+# Test for a target whose commands are defined twice.  This generates a
+# warning, not an error, so ensure that the correct commands are kept.
+#
+# Also ensure that the diagnostics mention the correct file in case of
+# included files.  This particular case had been broken in parse.c 1.231 from
+# 2018-12-22.
+
+# expect: make: "dep-duplicate.inc" line 15: warning: using previous script for "all" defined here
+# FIXME: The file "dep-duplicate.inc" has no line 15.
+
+# expect: first
+all: .PHONY
+       @echo first
+
+_!=    echo 'all:;echo second' > dep-duplicate.inc
+.include "${.CURDIR}/dep-duplicate.inc"
+
+.END:
+       @rm -f dep-duplicate.inc
diff -r 481c6e65047c -r b8b43947a028 usr.bin/make/unit-tests/dep-wildcards.exp
--- a/usr.bin/make/unit-tests/dep-wildcards.exp Wed Jan 19 13:33:49 2022 +0000
+++ b/usr.bin/make/unit-tests/dep-wildcards.exp Wed Jan 19 22:10:41 2022 +0000
@@ -2,6 +2,7 @@
 dep-colon.mk
 dep-double-colon-indep.mk
 dep-double-colon.mk
+dep-duplicate.mk
 dep-exclam.mk
 dep-none.mk
 dep-op-missing.mk



Home | Main Index | Thread Index | Old Index