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 .USE combined ...



details:   https://anonhg.NetBSD.org/src/rev/72033a899873
branches:  trunk
changeset: 974743:72033a899873
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 09 16:32:28 2020 +0000

description:
make(1): add test for .USE combined with inference rule without commands

Discovered by christos.

diffstat:

 distrib/sets/lists/tests/mi               |   4 ++-
 usr.bin/make/unit-tests/Makefile          |   3 +-
 usr.bin/make/unit-tests/use-inference.exp |   4 +++
 usr.bin/make/unit-tests/use-inference.mk  |  35 +++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 2 deletions(-)

diffs (82 lines):

diff -r 7596a394bc37 -r 72033a899873 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Aug 09 15:54:13 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Aug 09 16:32:28 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.887 2020/08/09 12:59:16 rillig Exp $
+# $NetBSD: mi,v 1.888 2020/08/09 16:32:28 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4616,6 +4616,8 @@
 ./usr/tests/usr.bin/make/unit-tests/unexport-env.mk    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/unexport.exp       tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/unexport.mk        tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/use-inference.exp  tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/use-inference.mk   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varcmd.exp tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varcmd.mk  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/vardebug.exp       tests-usr.bin-tests     compattestfile,atf
diff -r 7596a394bc37 -r 72033a899873 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Aug 09 15:54:13 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Aug 09 16:32:28 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.90 2020/08/09 12:59:16 rillig Exp $
+# $NetBSD: Makefile,v 1.91 2020/08/09 16:32:28 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -79,6 +79,7 @@
 TESTS+=                ternary
 TESTS+=                unexport
 TESTS+=                unexport-env
+TESTS+=                use-inference
 TESTS+=                varcmd
 TESTS+=                vardebug
 TESTS+=                varfind
diff -r 7596a394bc37 -r 72033a899873 usr.bin/make/unit-tests/use-inference.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/use-inference.exp Sun Aug 09 16:32:28 2020 +0000
@@ -0,0 +1,4 @@
+Building use-inference.from from nothing
+make: don't know how to make use-inference.to (continuing)
+`all' not remade because of errors.
+exit status 0
diff -r 7596a394bc37 -r 72033a899873 usr.bin/make/unit-tests/use-inference.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/use-inference.mk  Sun Aug 09 16:32:28 2020 +0000
@@ -0,0 +1,35 @@
+# $NetBSD: use-inference.mk,v 1.1 2020/08/09 16:32:28 rillig Exp $
+#
+# Demonstrate that .USE rules do not have an effect on inference rules.
+# At least not in the special case where the inference rule does not
+# have any associated commands.
+
+.SUFFIXES:
+.SUFFIXES: .from .to
+
+all: use-inference.to
+
+verbose: .USE
+       @echo 'Verbosely making $@ out of $>'
+
+.from.to: verbose
+# Since this inference rule does not have any associated commands, it
+# is ignored.
+#
+#      @echo 'Building $@ from $<'
+
+use-inference.from:            # assume it exists
+       @echo 'Building $@ from nothing'
+
+# Possible but unproven explanation:
+#
+# The main target is "all", which depends on "use-inference.to".
+# The inference connects the .from to the .to file, otherwise make
+# would not know that the .from file would need to be built.
+#
+# The .from file is then built.
+#
+# After this, make stops since it doesn't know how to make the .to file.
+# This is strange since make definitely knows about the .from.to suffix
+# inference rule.  But it seems to ignore it, maybe because it doesn't
+# have any associated commands.



Home | Main Index | Thread Index | Old Index