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 the '::' depen...



details:   https://anonhg.NetBSD.org/src/rev/2f2f8f2318c1
branches:  trunk
changeset: 977407:2f2f8f2318c1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 23 19:11:30 2020 +0000

description:
make(1): add test for the '::' dependency operator

diffstat:

 distrib/sets/lists/tests/mi                        |   4 ++-
 usr.bin/make/make.h                                |  12 +++++--
 usr.bin/make/unit-tests/Makefile                   |   3 +-
 usr.bin/make/unit-tests/dep-double-colon-indep.exp |   3 ++
 usr.bin/make/unit-tests/dep-double-colon-indep.mk  |  32 ++++++++++++++++++++++
 usr.bin/make/unit-tests/dep-wildcards.exp          |   1 +
 6 files changed, 49 insertions(+), 6 deletions(-)

diffs (116 lines):

diff -r b8540c0e9fec -r 2f2f8f2318c1 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Oct 23 19:03:42 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Oct 23 19:11:30 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.946 2020/10/23 14:24:51 rillig Exp $
+# $NetBSD: mi,v 1.947 2020/10/23 19:11:30 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4627,6 +4627,8 @@
 ./usr/tests/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk                        tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-colon.exp                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-colon.mk                               tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.exp                 tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.mk                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.exp                       tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.mk                                tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.exp                             tests-usr.bin-tests     compattestfile,atf
diff -r b8540c0e9fec -r 2f2f8f2318c1 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Fri Oct 23 19:03:42 2020 +0000
+++ b/usr.bin/make/make.h       Fri Oct 23 19:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.164 2020/10/23 18:36:09 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.165 2020/10/23 19:11:30 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -191,11 +191,15 @@
  *
  * Some of the OP_ constants can be combined, others cannot. */
 typedef enum GNodeType {
-    /* Execution of commands depends on children (:) */
+    /* The dependency operator ':' is the most common one.  The commands of
+     * this node are executed if any child is out-of-date. */
     OP_DEPENDS         = 1 << 0,
-    /* Always execute commands (!) */
+    /* The dependency operator '!' always executes its commands, even if
+     * its children are up-to-date. */
     OP_FORCE           = 1 << 1,
-    /* Execution of commands depends on children per line (::) */
+    /* The dependency operator '::' behaves like ':', except that it allows
+     * multiple dependency groups to be defined.  Each of these groups is
+     * executed on its own, independently from the others. */
     OP_DOUBLEDEP       = 1 << 2,
 
     /* Matches the dependency operators ':', '!' and '::'. */
diff -r b8540c0e9fec -r 2f2f8f2318c1 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Fri Oct 23 19:03:42 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Fri Oct 23 19:11:30 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.171 2020/10/23 14:38:39 rillig Exp $
+# $NetBSD: Makefile,v 1.172 2020/10/23 19:11:30 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -75,6 +75,7 @@
 TESTS+=                dep-colon
 TESTS+=                dep-colon-bug-cross-file
 TESTS+=                dep-double-colon
+TESTS+=                dep-double-colon-indep
 TESTS+=                dep-exclam
 TESTS+=                dep-none
 TESTS+=                dep-var
diff -r b8540c0e9fec -r 2f2f8f2318c1 usr.bin/make/unit-tests/dep-double-colon-indep.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/dep-double-colon-indep.exp        Fri Oct 23 19:11:30 2020 +0000
@@ -0,0 +1,3 @@
+: 'Making 1400 dep-double-colon-1300 from dep-double-colon-1400 oodate dep-double-colon-1400'
+: 'Making 1500 dep-double-colon-1300 from dep-double-colon-1500 oodate dep-double-colon-1500'
+exit status 0
diff -r b8540c0e9fec -r 2f2f8f2318c1 usr.bin/make/unit-tests/dep-double-colon-indep.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/dep-double-colon-indep.mk Fri Oct 23 19:11:30 2020 +0000
@@ -0,0 +1,32 @@
+# $NetBSD: dep-double-colon-indep.mk,v 1.1 2020/10/23 19:11:30 rillig Exp $
+#
+# Tests for the :: operator in dependency declarations, which allows multiple
+# dependency groups with the same target.  Each group is evaluated on its own,
+# independent of the other groups.
+#
+# This is useful for targets that are updatable, such as a database or a log
+# file.  Be careful with parallel mode though, to avoid lost updates and
+# other inconsistencies.
+#
+# The target 1300 depends on 1200, 1400 and 1500.  The target 1200 is older
+# than 1300, therefore nothing is done for it.  The other targets are newer
+# than 1300, therefore each of them is made, independently from the other.
+
+.END:
+       @rm -f dep-double-colon-1???
+
+_!=    touch -t 202001011200 dep-double-colon-1200
+_!=    touch -t 202001011300 dep-double-colon-1300
+_!=    touch -t 202001011400 dep-double-colon-1400
+_!=    touch -t 202001011500 dep-double-colon-1500
+
+all: dep-double-colon-1300
+
+dep-double-colon-1300:: dep-double-colon-1200
+       : 'Making 1200 ${.TARGET} from ${.ALLSRC} oodate ${.OODATE}'
+
+dep-double-colon-1300:: dep-double-colon-1400
+       : 'Making 1400 ${.TARGET} from ${.ALLSRC} oodate ${.OODATE}'
+
+dep-double-colon-1300:: dep-double-colon-1500
+       : 'Making 1500 ${.TARGET} from ${.ALLSRC} oodate ${.OODATE}'
diff -r b8540c0e9fec -r 2f2f8f2318c1 usr.bin/make/unit-tests/dep-wildcards.exp
--- a/usr.bin/make/unit-tests/dep-wildcards.exp Fri Oct 23 19:03:42 2020 +0000
+++ b/usr.bin/make/unit-tests/dep-wildcards.exp Fri Oct 23 19:11:30 2020 +0000
@@ -1,5 +1,6 @@
 dep-colon-bug-cross-file.mk
 dep-colon.mk
+dep-double-colon-indep.mk
 dep-double-colon.mk
 dep-exclam.mk
 dep-none.mk



Home | Main Index | Thread Index | Old Index