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 tests/make: demonstrate combination ...



details:   https://anonhg.NetBSD.org/src/rev/c6cf358b6241
branches:  trunk
changeset: 360004:c6cf358b6241
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Feb 07 22:43:50 2022 +0000

description:
tests/make: demonstrate combination of .USE with transformation rule

Reported in 2003 in PR toolchain/20993.  Linking a transformation rule
with .USE or .USEBEFORE node makes the transformation rule fail.

diffstat:

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

diffs (100 lines):

diff -r 31f9e032d631 -r c6cf358b6241 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Mon Feb 07 21:57:47 2022 +0000
+++ b/distrib/sets/lists/tests/mi       Mon Feb 07 22:43:50 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1185 2022/01/23 18:00:53 rillig Exp $
+# $NetBSD: mi,v 1.1186 2022/02/07 22:43:50 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5917,6 +5917,8 @@
 ./usr/tests/usr.bin/make/unit-tests/suff-transform-expand.mk                   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-transform-select.exp                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-transform-select.mk                   tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-use.exp                               tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-use.mk                                        tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suffixes.exp                               tests-obsolete          obsolete
 ./usr/tests/usr.bin/make/unit-tests/suffixes.mk                                        tests-obsolete          obsolete
 ./usr/tests/usr.bin/make/unit-tests/sunshcmd.exp                               tests-usr.bin-tests     compattestfile,atf
diff -r 31f9e032d631 -r c6cf358b6241 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Mon Feb 07 21:57:47 2022 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Mon Feb 07 22:43:50 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.302 2022/01/27 21:50:50 sjg Exp $
+# $NetBSD: Makefile,v 1.303 2022/02/07 22:43:50 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -314,6 +314,7 @@
 TESTS+=                suff-transform-endless
 TESTS+=                suff-transform-expand
 TESTS+=                suff-transform-select
+TESTS+=                suff-use
 TESTS+=                sunshcmd
 TESTS+=                ternary
 TESTS+=                unexport
diff -r 31f9e032d631 -r c6cf358b6241 usr.bin/make/unit-tests/suff-use.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-use.exp      Mon Feb 07 22:43:50 2022 +0000
@@ -0,0 +1,7 @@
+: 'Making demo.c out of nothing'
+make: don't know how to make demo.o (continuing)
+`all' not remade because of errors.
+
+Stop.
+make: stopped in unit-tests
+exit status 1
diff -r 31f9e032d631 -r c6cf358b6241 usr.bin/make/unit-tests/suff-use.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-use.mk       Mon Feb 07 22:43:50 2022 +0000
@@ -0,0 +1,50 @@
+# $NetBSD: suff-use.mk,v 1.1 2022/02/07 22:43:50 rillig Exp $
+#
+# This test combines a .USE node with suffix rules, trying to add an
+# additional command before and after successful compilation of a .c file.
+#
+# History:
+#      bin/make-2001.11.12.21.58.18-plain
+#      | : 'Making demo.c out of nothing'
+#      | make: don't know how to make demo.o. Stop
+#      |
+#      | make: stopped in /home/rillig/proj/make-archive
+#      | exit status 2
+#      bin/make-2007.10.11.21.19.28-plain
+#
+#      bin/make-2014.08.23.15.05.40-plain
+#      | : 'Making demo.c out of nothing'
+#      | : 'Compiling demo.c to demo.o'
+#      | exit status 0
+#      bin/make-2014.09.05.06.57.20-plain
+#
+#      bin/make-2014.09.07.20.55.34-plain
+#      | : 'Making demo.c out of nothing'
+#      | make: don't know how to make demo.o. Stop
+#      |
+#      | make: stopped in /home/rillig/proj/make-archive
+#      | exit status 2
+#      ...
+#
+# See also:
+#      https://gnats.netbsd.org/20993
+
+
+.SUFFIXES: .c .o
+
+all: demo.o
+
+.c.o:
+       : 'Compiling ${.IMPSRC} to ${.TARGET}'
+
+demo.c:
+       : 'Making ${.TARGET} out of nothing'
+
+using-before: .USEBEFORE
+       : 'Before making ${.TARGET} from ${.ALLSRCS}'
+
+using-after: .USE
+       : 'After making ${.TARGET} from ${.ALLSRCS}'
+
+# expect: make: don't know how to make demo.o (continuing)
+.c.o: using-before using-after



Home | Main Index | Thread Index | Old Index