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 comments and ...
details: https://anonhg.NetBSD.org/src/rev/b92a466bdc66
branches: trunk
changeset: 957777:b92a466bdc66
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Dec 11 01:06:10 2020 +0000
description:
make(1): add tests for comments and non-comments in jobs mode
diffstat:
usr.bin/make/unit-tests/sh-jobs.exp | 7 ++++++-
usr.bin/make/unit-tests/sh-jobs.mk | 34 ++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 5 deletions(-)
diffs (54 lines):
diff -r 10f0cd2896b2 -r b92a466bdc66 usr.bin/make/unit-tests/sh-jobs.exp
--- a/usr.bin/make/unit-tests/sh-jobs.exp Fri Dec 11 00:29:01 2020 +0000
+++ b/usr.bin/make/unit-tests/sh-jobs.exp Fri Dec 11 01:06:10 2020 +0000
@@ -1,1 +1,6 @@
-exit status 0
+comment-with-followup-line: This is printed.
+no-comment: This is printed.
+*** [no-comment] Error code 1
+
+make: stopped in unit-tests
+exit status 1
diff -r 10f0cd2896b2 -r b92a466bdc66 usr.bin/make/unit-tests/sh-jobs.mk
--- a/usr.bin/make/unit-tests/sh-jobs.mk Fri Dec 11 00:29:01 2020 +0000
+++ b/usr.bin/make/unit-tests/sh-jobs.mk Fri Dec 11 01:06:10 2020 +0000
@@ -1,9 +1,35 @@
-# $NetBSD: sh-jobs.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: sh-jobs.mk,v 1.3 2020/12/11 01:06:10 rillig Exp $
#
# Tests for the "run in jobs mode" part of the "Shell Commands" section
# from the manual page.
-# TODO: Implementation
+# TODO: Tutorial
+
+.MAKEFLAGS: -j1
+
+all: .PHONY comment .WAIT comment-with-followup-line .WAIT no-comment
+
+# If a shell command starts with a comment character after stripping the
+# leading '@', it is run in ignore-errors mode since the default runChkTmpl
+# would lead to a syntax error in the generated shell file, at least for
+# bash and dash, but not for NetBSD sh and ksh.
+#
+# See JobPrintCommand, cmdTemplate, runIgnTmpl
+comment: .PHONY
+ @# comment
-all:
- @:;
+# If a shell command starts with a comment character after stripping the
+# leading '@', it is run in ignore-errors mode.
+#
+# See JobPrintCommand, cmdTemplate, runIgnTmpl
+comment-with-followup-line: .PHONY
+ @# comment${.newline}echo '$@: This is printed.'; false
+ @true
+
+# Without the comment, the commands are run in the default mode, which checks
+# the exit status of every makefile line.
+#
+# See JobPrintCommand, cmdTemplate, runChkTmpl
+no-comment: .PHONY
+ @echo '$@: This is printed.'; false
+ @true
Home |
Main Index |
Thread Index |
Old Index