Module Name:    src
Committed By:   rillig
Date:           Sun Feb 14 20:16:18 UTC 2021

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile varmod-shell.mk
Added Files:
        src/usr.bin/make/unit-tests: varmod-sun-shell.exp varmod-sun-shell.mk

Log Message:
make: add test for the variable modifier ':sh'


To generate a diff of this commit:
cvs rdiff -u -r1.1017 -r1.1018 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.270 -r1.271 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-shell.mk
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-sun-shell.exp \
    src/usr.bin/make/unit-tests/varmod-sun-shell.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1017 src/distrib/sets/lists/tests/mi:1.1018
--- src/distrib/sets/lists/tests/mi:1.1017	Sat Feb 13 06:29:45 2021
+++ src/distrib/sets/lists/tests/mi	Sun Feb 14 20:16:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1017 2021/02/13 06:29:45 rillig Exp $
+# $NetBSD: mi,v 1.1018 2021/02/14 20:16:17 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5473,6 +5473,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varmod-subst-regex.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-subst.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-subst.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varmod-sun-shell.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varmod-sun-shell.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-sysv.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-sysv.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-tail.exp				tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.270 src/usr.bin/make/unit-tests/Makefile:1.271
--- src/usr.bin/make/unit-tests/Makefile:1.270	Sun Feb 14 13:24:45 2021
+++ src/usr.bin/make/unit-tests/Makefile	Sun Feb 14 20:16:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.270 2021/02/14 13:24:45 rillig Exp $
+# $NetBSD: Makefile,v 1.271 2021/02/14 20:16:17 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -362,6 +362,7 @@ TESTS+=		varmod-select-words
 TESTS+=		varmod-shell
 TESTS+=		varmod-subst
 TESTS+=		varmod-subst-regex
+TESTS+=		varmod-sun-shell
 TESTS+=		varmod-sysv
 TESTS+=		varmod-tail
 TESTS+=		varmod-to-abs

Index: src/usr.bin/make/unit-tests/varmod-shell.mk
diff -u src/usr.bin/make/unit-tests/varmod-shell.mk:1.5 src/usr.bin/make/unit-tests/varmod-shell.mk:1.6
--- src/usr.bin/make/unit-tests/varmod-shell.mk:1.5	Tue Nov 17 20:11:02 2020
+++ src/usr.bin/make/unit-tests/varmod-shell.mk	Sun Feb 14 20:16:17 2021
@@ -1,15 +1,13 @@
-# $NetBSD: varmod-shell.mk,v 1.5 2020/11/17 20:11:02 rillig Exp $
+# $NetBSD: varmod-shell.mk,v 1.6 2021/02/14 20:16:17 rillig Exp $
 #
-# Tests for the :sh variable modifier, which runs the shell command
-# given by the variable value and returns its output.
+# Tests for the ':!cmd!' variable modifier, which runs the shell command
+# given by the variable modifier and returns its output.
 #
 # This modifier has been added on 2000-04-29.
 #
 # See also:
 #	ApplyModifier_ShellCommand
 
-# TODO: Implementation
-
 # The command to be run is enclosed between exclamation marks.
 # The previous value of the expression is irrelevant for this modifier.
 # The :!cmd! modifier turns an undefined expression into a defined one.
@@ -32,4 +30,3 @@
 .endif
 
 all:
-	@:;

Added files:

Index: src/usr.bin/make/unit-tests/varmod-sun-shell.exp
diff -u /dev/null src/usr.bin/make/unit-tests/varmod-sun-shell.exp:1.1
--- /dev/null	Sun Feb 14 20:16:18 2021
+++ src/usr.bin/make/unit-tests/varmod-sun-shell.exp	Sun Feb 14 20:16:17 2021
@@ -0,0 +1,2 @@
+make: "echo word; false" returned non-zero status
+exit status 0
Index: src/usr.bin/make/unit-tests/varmod-sun-shell.mk
diff -u /dev/null src/usr.bin/make/unit-tests/varmod-sun-shell.mk:1.1
--- /dev/null	Sun Feb 14 20:16:18 2021
+++ src/usr.bin/make/unit-tests/varmod-sun-shell.mk	Sun Feb 14 20:16:17 2021
@@ -0,0 +1,21 @@
+# $NetBSD: varmod-sun-shell.mk,v 1.1 2021/02/14 20:16:17 rillig Exp $
+#
+# Tests for the :sh variable modifier, which runs the shell command
+# given by the variable value and returns its output.
+#
+# This modifier has been added on 1996-05-29.
+#
+# See also:
+#	ApplyModifier_SunShell
+
+.if ${echo word:L:sh} != "word"
+.  error
+.endif
+
+# If the command exits with non-zero, an error message is printed.
+# XXX: Processing continues as usual though.
+.if ${echo word; false:L:sh} != "word"
+.  error
+.endif
+
+all:

Reply via email to