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 deleting the s...



details:   https://anonhg.NetBSD.org/src/rev/6c3fe84a4c8b
branches:  trunk
changeset: 1014528:6c3fe84a4c8b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 25 18:18:25 2020 +0000

description:
make(1): add test for deleting the suffixes during parsing

diffstat:

 distrib/sets/lists/tests/mi              |   4 ++-
 usr.bin/make/unit-tests/Makefile         |   3 +-
 usr.bin/make/unit-tests/suff-rebuild.exp |   5 ++++
 usr.bin/make/unit-tests/suff-rebuild.mk  |  33 ++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 2 deletions(-)

diffs (81 lines):

diff -r 873a819fa8c8 -r 6c3fe84a4c8b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Sep 25 17:55:19 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Sep 25 18:18:25 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.928 2020/09/25 05:56:59 rillig Exp $
+# $NetBSD: mi,v 1.929 2020/09/25 18:18:25 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4960,6 +4960,8 @@
 ./usr/tests/usr.bin/make/unit-tests/sh-single-line.mk                          tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/sh.exp                                     tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/sh.mk                                      tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exp                           tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-rebuild.mk                            tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suffixes.exp                               tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suffixes.mk                                        tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/sunshcmd.exp                               tests-usr.bin-tests     compattestfile,atf
diff -r 873a819fa8c8 -r 6c3fe84a4c8b usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Fri Sep 25 17:55:19 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Fri Sep 25 18:18:25 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.149 2020/09/25 05:56:59 rillig Exp $
+# $NetBSD: Makefile,v 1.150 2020/09/25 18:18:25 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -242,6 +242,7 @@
 TESTS+=                sh-multi-line
 TESTS+=                sh-single-line
 TESTS+=                # suffixes      # runs into an endless loop (try -dA)
+TESTS+=                suff-rebuild
 TESTS+=                sunshcmd
 TESTS+=                sysv
 TESTS+=                ternary
diff -r 873a819fa8c8 -r 6c3fe84a4c8b usr.bin/make/unit-tests/suff-rebuild.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-rebuild.exp  Fri Sep 25 18:18:25 2020 +0000
@@ -0,0 +1,5 @@
+: from nothing to a
+: from a to b
+: from b to c
+: from c to nothing
+exit status 0
diff -r 873a819fa8c8 -r 6c3fe84a4c8b usr.bin/make/unit-tests/suff-rebuild.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-rebuild.mk   Fri Sep 25 18:18:25 2020 +0000
@@ -0,0 +1,33 @@
+# $NetBSD: suff-rebuild.mk,v 1.1 2020/09/25 18:18:25 rillig Exp $
+#
+# Demonstrates what happens to transformation rules (called inference rules
+# by POSIX) when all suffixes are deleted.
+
+all: suff-rebuild-example
+
+.SUFFIXES:
+
+.SUFFIXES: .a .b .c
+
+suff-rebuild-example.a:
+       : from nothing to a
+
+.a.b:
+       : from a to b
+.b.c:
+       : from b to c
+.c:
+       : from c to nothing
+
+# XXX: At a quick glance, the code in SuffScanTargets looks at if it were
+# possible to delete the suffixes in the middle of the makefile, add back
+# the suffixes from before, and have the transformation rules preserved.
+#
+# As of 2020-09-25, uncommenting the following line results in the error
+# message "don't know how to make suff-rebuild-example" though.
+#
+#.SUFFIXES:
+
+# Add the suffixes back.  It should not matter that the order of the suffixes
+# is different from before.
+.SUFFIXES: .c .b .a



Home | Main Index | Thread Index | Old Index