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): extend test suff-lookup.mk



details:   https://anonhg.NetBSD.org/src/rev/390e9ddb506d
branches:  trunk
changeset: 956194:390e9ddb506d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 24 03:18:22 2020 +0000

description:
make(1): extend test suff-lookup.mk

This test ensures that FindSuffByName behaves correctly.

In order to convert some char pointers to const char pointers, there
needs to be FindSuffByNameLen, and to make sure that this function
actually uses the given length, this test has the suffixes ".sho" and
".short".  Without the proper string comparison in FindSuffByNameLen,
the suffix ".short" might be found when searching for ".sho".

diffstat:

 usr.bin/make/unit-tests/suff-lookup.exp |  40 ++++++++++++++++++++++----------
 usr.bin/make/unit-tests/suff-lookup.mk  |  14 ++++++++---
 2 files changed, 37 insertions(+), 17 deletions(-)

diffs (94 lines):

diff -r a8f780a9b866 -r 390e9ddb506d usr.bin/make/unit-tests/suff-lookup.exp
--- a/usr.bin/make/unit-tests/suff-lookup.exp   Sat Oct 24 03:01:19 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-lookup.exp   Sat Oct 24 03:18:22 2020 +0000
@@ -14,22 +14,36 @@
 inserting ".sho" (5) at end of list
 inserting ".c" (1) at end of list
 transformation .sho.c complete
+defining transformation from `.dead-end' to `.short'
+inserting ".dead-end" (6) at end of list
+inserting ".short" (4) at end of list
+transformation .dead-end.short complete
+inserting ".ccc" (3) at end of list
+inserting ".cc" (2) at end of list
+inserting ".c" (1) at end of list
+inserting ".ccc" (3) at end of list
+inserting ".short" (4) at end of list
+inserting ".c" (1) at end of list
+inserting ".sho" (5) at end of list
+inserting ".c" (1) at end of list
+inserting ".dead-end" (6) at end of list
+inserting ".short" (4) at end of list
 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 "suff-lookup.cc"...suffix is ".cc"...SuffFindDeps (suff-lookup.cc)
+       trying suff-lookup.ccc...not there
+       trying suff-lookup.c...not there
+       trying suff-lookup.short...not there
+       trying suff-lookup.sho...got it
+       applying .sho -> .c to "suff-lookup.c"
+       applying .c -> .ccc to "suff-lookup.ccc"
+       applying .ccc -> .cc to "suff-lookup.cc"
+suffix is ".ccc"...suffix is ".c"...suffix is ".sho"...SuffFindDeps (suff-lookup.sho)
+suffix is ".sho"...: 'Making suff-lookup.sho out of nothing.'
+: 'Making suff-lookup.c from suff-lookup.sho.'
+: 'Making suff-lookup.ccc from suff-lookup.c.'
+: 'Making suff-lookup.cc from suff-lookup.ccc.'
 Wildcard expanding "all"...SuffFindDeps (.END)
        No known suffix on .END. Using .NULL suffix
 adding suffix rules
diff -r a8f780a9b866 -r 390e9ddb506d usr.bin/make/unit-tests/suff-lookup.mk
--- a/usr.bin/make/unit-tests/suff-lookup.mk    Sat Oct 24 03:01:19 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-lookup.mk    Sat Oct 24 03:18:22 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: suff-lookup.mk,v 1.1 2020/10/24 02:25:02 rillig Exp $
+# $NetBSD: suff-lookup.mk,v 1.2 2020/10/24 03:18:22 rillig Exp $
 #
 # Demonstrate name resolution for suffixes.
 #
@@ -7,14 +7,14 @@
 
 .MAKEFLAGS: -ds
 
-all: suff-main.cc
+all: suff-lookup.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
+.SUFFIXES: .short .sho .dead-end
 
 # From long to short suffix.
 .ccc.cc:
@@ -28,7 +28,13 @@
        : 'Making ${.TARGET} from ${.IMPSRC}.'
 .sho.c:
        : 'Making ${.TARGET} from ${.IMPSRC}.'
+.dead-end.short:
+       : 'Making ${.TARGET} from ${.IMPSRC}.'
 
-suff-main.sho:
+suff-lookup.sho:
        : 'Making ${.TARGET} out of nothing.'
 
+# Deleting all suffixes and adding them again rebuilds all of the above
+# transformation rules.
+.SUFFIXES:
+.SUFFIXES: .c .cc .ccc .short .sho .dead-end



Home | Main Index | Thread Index | Old Index