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 incomplete tra...



details:   https://anonhg.NetBSD.org/src/rev/8b61201fb027
branches:  trunk
changeset: 946198:8b61201fb027
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 21 10:32:42 2020 +0000

description:
make(1): add test for incomplete transformation rule

diffstat:

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

diffs (114 lines):

diff -r ff3c11a2b965 -r 8b61201fb027 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Nov 21 09:53:40 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Nov 21 10:32:42 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.970 2020/11/16 15:12:16 rillig Exp $
+# $NetBSD: mi,v 1.971 2020/11/21 10:32:42 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5279,6 +5279,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-incomplete.exp                                tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-incomplete.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
diff -r ff3c11a2b965 -r 8b61201fb027 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sat Nov 21 09:53:40 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sat Nov 21 10:32:42 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.211 2020/11/19 23:50:26 rillig Exp $
+# $NetBSD: Makefile,v 1.212 2020/11/21 10:32:42 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -263,6 +263,7 @@
 TESTS+=                suff-add-later
 TESTS+=                suff-clear-regular
 TESTS+=                suff-clear-single
+TESTS+=                suff-incomplete
 TESTS+=                suff-lookup
 TESTS+=                suff-main
 TESTS+=                suff-rebuild
diff -r ff3c11a2b965 -r 8b61201fb027 usr.bin/make/unit-tests/suff-incomplete.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-incomplete.exp       Sat Nov 21 10:32:42 2020 +0000
@@ -0,0 +1,41 @@
+ParseReadLine (9): '.SUFFIXES:'
+ParseDoDependency(.SUFFIXES:)
+ParseReadLine (11): '.SUFFIXES: .a .b .c'
+ParseDoDependency(.SUFFIXES: .a .b .c)
+Adding suffix ".a"
+Adding suffix ".b"
+Adding suffix ".c"
+ParseReadLine (17): '.a.b:'
+ParseDoDependency(.a.b:)
+defining transformation from `.a' to `.b'
+inserting ".a" (1) at end of list
+inserting ".b" (2) at end of list
+ParseReadLine (21): '.a.c: ${.PREFIX}.dependency'
+deleting incomplete transformation from `.a' to `.b'
+ParseDoDependency(.a.c: ${.PREFIX}.dependency)
+defining transformation from `.a' to `.c'
+inserting ".a" (1) at end of list
+inserting ".c" (3) at end of list
+# LinkSource: added child .a.c - ${.PREFIX}.dependency
+# .a.c, made UNMADE, type OP_DEPENDS|OP_TRANSFORM, flags none
+# ${.PREFIX}.dependency, made UNMADE, type none, flags none
+ParseReadLine (23): '.DEFAULT:'
+transformation .a.c complete
+ParseDoDependency(.DEFAULT:)
+ParseReadLine (24): '  : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.'
+transformation .DEFAULT complete
+Wildcard expanding "all"...
+SuffFindDeps (all)
+       No known suffix on all. Using .NULL suffix
+adding suffix rules
+Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
+SuffFindDeps (suff-incomplete.c)
+       trying suff-incomplete.a...not there
+Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
+: Making suff-incomplete.c from suff-incomplete.c all  by default.
+Wildcard expanding "all"...
+SuffFindDeps (.END)
+       No known suffix on .END. Using .NULL suffix
+adding suffix rules
+Wildcard expanding ".END"...
+exit status 0
diff -r ff3c11a2b965 -r 8b61201fb027 usr.bin/make/unit-tests/suff-incomplete.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-incomplete.mk        Sat Nov 21 10:32:42 2020 +0000
@@ -0,0 +1,30 @@
+# $NetBSD: suff-incomplete.mk,v 1.1 2020/11/21 10:32:42 rillig Exp $
+#
+# Tests incomplete transformation rules, which are ignored.
+
+all: suff-incomplete.c
+
+.MAKEFLAGS: -dps
+
+.SUFFIXES:
+
+.SUFFIXES: .a .b .c
+
+# This rule has no commands and no dependencies, therefore it is incomplete
+# and not added to the transformation rules.
+#
+# See Suff_EndTransform.
+.a.b:
+
+# This rule has a dependency, therefore it is a complete transformation.
+# Its commands are taken from a .DEFAULT target, if there is any.
+.a.c: ${.PREFIX}.dependency
+
+.DEFAULT:
+       : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.
+
+# XXX: The debug log says "transformation .DEFAULT complete", which is wrong.
+# .DEFAULT is not a transformation.
+
+# XXX: The output of this test says "Making suff-incomplete.c from
+# suff-incomplete.c".  It doesn't make sense to make something out of itself.



Home | Main Index | Thread Index | Old Index