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 tests for some of the s...
details: https://anonhg.NetBSD.org/src/rev/244f525a6d13
branches: trunk
changeset: 975740:244f525a6d13
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Sep 05 15:57:12 2020 +0000
description:
make(1): add tests for some of the special sources
diffstat:
usr.bin/make/unit-tests/depsrc-exec.exp | 1 +
usr.bin/make/unit-tests/depsrc-exec.mk | 18 +++++++++++++-----
usr.bin/make/unit-tests/depsrc-made.exp | 2 ++
usr.bin/make/unit-tests/depsrc-made.mk | 17 ++++++++++++-----
usr.bin/make/unit-tests/depsrc-make.exp | 2 ++
usr.bin/make/unit-tests/depsrc-make.mk | 18 +++++++++++++-----
usr.bin/make/unit-tests/depsrc-notmain.exp | 1 +
usr.bin/make/unit-tests/depsrc-notmain.mk | 11 +++++++----
usr.bin/make/unit-tests/depsrc-optional.exp | 1 +
usr.bin/make/unit-tests/depsrc-optional.mk | 20 +++++++++++++++-----
usr.bin/make/unit-tests/depsrc-phony.exp | 1 +
usr.bin/make/unit-tests/depsrc-phony.mk | 13 +++++++------
usr.bin/make/unit-tests/depsrc-recursive.exp | 2 ++
usr.bin/make/unit-tests/depsrc-recursive.mk | 18 +++++++++++++-----
14 files changed, 90 insertions(+), 35 deletions(-)
diffs (209 lines):
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-exec.exp
--- a/usr.bin/make/unit-tests/depsrc-exec.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-exec.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,2 @@
+: depsrc-exec.mk: This is always executed.
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-exec.mk
--- a/usr.bin/make/unit-tests/depsrc-exec.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-exec.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,16 @@
-# $NetBSD: depsrc-exec.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-exec.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .EXEC in dependency declarations.
+# Tests for the special source .EXEC in dependency declarations,
+# which always executes the commands, even if the target is up to date.
+# The target itself is considered up to date.
+#
+# TODO: Describe possible use cases for .EXEC.
-# TODO: Implementation
+all: ${MAKEFILE} ${MAKEFILE:H}/depsrc.mk
-all:
- @:;
+${MAKEFILE}: .EXEC
+ : ${.TARGET:T}: This is always executed.
+
+${MAKEFILE:H}/depsrc.mk:
+ : This is not executed.
+ +: ${.TARGET:T}: This is not executed as well.
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-made.exp
--- a/usr.bin/make/unit-tests/depsrc-made.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-made.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,3 @@
+: Making chapter21
+: Making chapter22
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-made.mk
--- a/usr.bin/make/unit-tests/depsrc-made.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-made.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,15 @@
-# $NetBSD: depsrc-made.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-made.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .MADE in dependency declarations.
+# Tests for the special source .MADE in dependency declarations,
+# which marks all its dependencies as already made, so their commands
+# don't need to be executed.
+#
+# TODO: Describe a possible use case for .MADE.
-# TODO: Implementation
+all: part1 part2
-all:
- @:;
+part1: chapter11 chapter12 .MADE
+part2: chapter21 chapter22
+
+chapter11 chapter12 chapter21 chapter22:
+ : Making ${.TARGET}
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-make.exp
--- a/usr.bin/make/unit-tests/depsrc-make.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-make.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,3 @@
+this-is-made is made.
+echo this-is-not-made is just echoed.
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-make.mk
--- a/usr.bin/make/unit-tests/depsrc-make.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-make.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,16 @@
-# $NetBSD: depsrc-make.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-make.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .MAKE in dependency declarations.
+# Tests for the special source .MAKE in dependency declarations, which
+# executes the commands of the target even if the -n or -t command line
+# options are given.
+
+.MAKEFLAGS: -n
-# TODO: Implementation
+all: this-is-made
+all: this-is-not-made
-all:
- @:;
+this-is-made: .MAKE
+ @echo ${.TARGET} is made.
+
+this-is-not-made:
+ @echo ${.TARGET} is just echoed.
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-notmain.exp
--- a/usr.bin/make/unit-tests/depsrc-notmain.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-notmain.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,2 @@
+: all
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-notmain.mk
--- a/usr.bin/make/unit-tests/depsrc-notmain.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-notmain.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,11 @@
-# $NetBSD: depsrc-notmain.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-notmain.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .NOTMAIN in dependency declarations.
+# Tests for the special source .NOTMAIN in dependency declarations,
+# which prevents the associated target from becoming the default target
+# to be made.
-# TODO: Implementation
+ignored: .NOTMAIN
+ : ${.TARGET}
all:
- @:;
+ : ${.TARGET}
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-optional.exp
--- a/usr.bin/make/unit-tests/depsrc-optional.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-optional.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,2 @@
+`all' is up to date.
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-optional.mk
--- a/usr.bin/make/unit-tests/depsrc-optional.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-optional.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,18 @@
-# $NetBSD: depsrc-optional.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-optional.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .OPTIONAL in dependency declarations.
+# Tests for the special source .OPTIONAL in dependency declarations,
+# which ignores the target if make cannot find out how to create it.
+#
+# TODO: Describe practical use cases for this feature.
-# TODO: Implementation
+# TODO: Explain why the commands for "important" are not executed.
+# I had thought that only the "optional" commands were skipped.
+
+all: important
+ : ${.TARGET} is made.
-all:
- @:;
+important: optional
+ : ${.TARGET} is made.
+
+optional: .OPTIONAL
+ : This is not executed.
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-phony.exp
--- a/usr.bin/make/unit-tests/depsrc-phony.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-phony.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,2 @@
+: depsrc-phony.mk is made.
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-phony.mk
--- a/usr.bin/make/unit-tests/depsrc-phony.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-phony.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: depsrc-phony.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-phony.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .PHONY in dependency declarations.
+# Tests for the special source .PHONY in dependency declarations,
+# which executes the commands for the target even if a file of the same
+# name exists and would be considered up to date.
-# TODO: Implementation
-
-all:
- @:;
+# Without the .PHONY, this target would be "up to date".
+${MAKEFILE}: .PHONY
+ : ${.TARGET:T} is made.
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-recursive.exp
--- a/usr.bin/make/unit-tests/depsrc-recursive.exp Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-recursive.exp Sat Sep 05 15:57:12 2020 +0000
@@ -1,1 +1,3 @@
+this-is-made is made.
+echo this-is-not-made is just echoed.
exit status 0
diff -r 5bdfb385cdfc -r 244f525a6d13 usr.bin/make/unit-tests/depsrc-recursive.mk
--- a/usr.bin/make/unit-tests/depsrc-recursive.mk Sat Sep 05 15:12:03 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-recursive.mk Sat Sep 05 15:57:12 2020 +0000
@@ -1,8 +1,16 @@
-# $NetBSD: depsrc-recursive.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-recursive.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
#
-# Tests for the special source .RECURSIVE in dependency declarations.
+# Tests for the special source .RECURSIVE in dependency declarations,
+# which executes the commands of the target even if the -n or -t command
+# line options are given.
+
+.MAKEFLAGS: -n
-# TODO: Implementation
+all: this-is-made
+all: this-is-not-made
-all:
- @:;
+this-is-made: .RECURSIVE
+ @echo ${.TARGET} is made.
+
+this-is-not-made:
+ @echo ${.TARGET} is just echoed.
Home |
Main Index |
Thread Index |
Old Index