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 looking up suf...



details:   https://anonhg.NetBSD.org/src/rev/20aa35ffcac1
branches:  trunk
changeset: 977416:20aa35ffcac1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 24 02:25:02 2020 +0000

description:
make(1): add test for looking up suffixes

diffstat:

 distrib/sets/lists/tests/mi             |   4 ++-
 usr.bin/make/unit-tests/Makefile        |   3 +-
 usr.bin/make/unit-tests/suff-lookup.exp |  37 +++++++++++++++++++++++++++++++++
 usr.bin/make/unit-tests/suff-lookup.mk  |  34 ++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 2 deletions(-)

diffs (114 lines):

diff -r 6de83fc19b1a -r 20aa35ffcac1 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Oct 23 22:14:47 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Oct 24 02:25:02 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.949 2020/10/23 19:54:35 rillig Exp $
+# $NetBSD: mi,v 1.950 2020/10/24 02:25:02 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4999,6 +4999,8 @@
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-regular.mk                      tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.exp                      tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.mk                       tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-lookup.exp                            tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-lookup.mk                             tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.exp                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.mk                               tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exp                           tests-usr.bin-tests     compattestfile,atf
diff -r 6de83fc19b1a -r 20aa35ffcac1 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Fri Oct 23 22:14:47 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sat Oct 24 02:25:02 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.174 2020/10/23 19:54:35 rillig Exp $
+# $NetBSD: Makefile,v 1.175 2020/10/24 02:25:02 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -254,6 +254,7 @@
 TESTS+=                suff-add-later
 TESTS+=                suff-clear-regular
 TESTS+=                suff-clear-single
+TESTS+=                suff-lookup
 TESTS+=                suff-main
 TESTS+=                suff-rebuild
 TESTS+=                suff-transform-endless
diff -r 6de83fc19b1a -r 20aa35ffcac1 usr.bin/make/unit-tests/suff-lookup.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-lookup.exp   Sat Oct 24 02:25:02 2020 +0000
@@ -0,0 +1,37 @@
+defining transformation from `.ccc' to `.cc'
+inserting ".ccc" (3) at end of list
+inserting ".cc" (2) at end of list
+transformation .ccc.cc complete
+defining transformation from `.c' to `.ccc'
+inserting ".c" (1) at end of list
+inserting ".ccc" (3) at end of list
+transformation .c.ccc complete
+defining transformation from `.short' to `.c'
+inserting ".short" (4) at end of list
+inserting ".c" (1) at end of list
+transformation .short.c complete
+defining transformation from `.sho' to `.c'
+inserting ".sho" (5) at end of list
+inserting ".c" (1) at end of list
+transformation .sho.c complete
+Wildcard expanding "all"...SuffFindDeps (all)
+       No known suffix on all. Using .NULL suffix
+adding suffix rules
+Wildcard expanding "suff-main.cc"...suffix is ".cc"...SuffFindDeps (suff-main.cc)
+       trying suff-main.ccc...not there
+       trying suff-main.c...not there
+       trying suff-main.short...not there
+       trying suff-main.sho...got it
+       applying .sho -> .c to "suff-main.c"
+       applying .c -> .ccc to "suff-main.ccc"
+       applying .ccc -> .cc to "suff-main.cc"
+suffix is ".ccc"...suffix is ".c"...suffix is ".sho"...SuffFindDeps (suff-main.sho)
+suffix is ".sho"...: 'Making suff-main.sho out of nothing.'
+: 'Making suff-main.c from suff-main.sho.'
+: 'Making suff-main.ccc from suff-main.c.'
+: 'Making suff-main.cc from suff-main.ccc.'
+Wildcard expanding "all"...SuffFindDeps (.END)
+       No known suffix on .END. Using .NULL suffix
+adding suffix rules
+Wildcard expanding ".END"...
+exit status 0
diff -r 6de83fc19b1a -r 20aa35ffcac1 usr.bin/make/unit-tests/suff-lookup.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-lookup.mk    Sat Oct 24 02:25:02 2020 +0000
@@ -0,0 +1,34 @@
+# $NetBSD: suff-lookup.mk,v 1.1 2020/10/24 02:25:02 rillig Exp $
+#
+# Demonstrate name resolution for suffixes.
+#
+# See also:
+#      FindSuffByName
+
+.MAKEFLAGS: -ds
+
+all: suff-main.cc
+
+.SUFFIXES: .c .cc .ccc
+
+# Register '.short' before '.sho'.  When searching for the transformation
+# '.sho.c', the suffix '.short' must not be found even though it starts with
+# the correct characters.
+.SUFFIXES: .short .sho
+
+# From long to short suffix.
+.ccc.cc:
+       : 'Making ${.TARGET} from ${.IMPSRC}.'
+
+# From short to long suffix.
+.c.ccc:
+       : 'Making ${.TARGET} from ${.IMPSRC}.'
+
+.short.c:
+       : 'Making ${.TARGET} from ${.IMPSRC}.'
+.sho.c:
+       : 'Making ${.TARGET} from ${.IMPSRC}.'
+
+suff-main.sho:
+       : 'Making ${.TARGET} out of nothing.'
+



Home | Main Index | Thread Index | Old Index