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: add test for the variable modi...



details:   https://anonhg.NetBSD.org/src/rev/f6114d7e1d54
branches:  trunk
changeset: 980679:f6114d7e1d54
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 14 20:16:17 2021 +0000

description:
make: add test for the variable modifier ':sh'

diffstat:

 distrib/sets/lists/tests/mi                  |   4 +++-
 usr.bin/make/unit-tests/Makefile             |   3 ++-
 usr.bin/make/unit-tests/varmod-shell.mk      |   9 +++------
 usr.bin/make/unit-tests/varmod-sun-shell.exp |   2 ++
 usr.bin/make/unit-tests/varmod-sun-shell.mk  |  21 +++++++++++++++++++++
 5 files changed, 31 insertions(+), 8 deletions(-)

diffs (93 lines):

diff -r 39164c5f74bd -r f6114d7e1d54 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Feb 14 19:47:16 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Feb 14 20:16:17 2021 +0000
@@ -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
diff -r 39164c5f74bd -r f6114d7e1d54 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Feb 14 19:47:16 2021 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Feb 14 20:16:17 2021 +0000
@@ -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-shell
 TESTS+=                varmod-subst
 TESTS+=                varmod-subst-regex
+TESTS+=                varmod-sun-shell
 TESTS+=                varmod-sysv
 TESTS+=                varmod-tail
 TESTS+=                varmod-to-abs
diff -r 39164c5f74bd -r f6114d7e1d54 usr.bin/make/unit-tests/varmod-shell.mk
--- a/usr.bin/make/unit-tests/varmod-shell.mk   Sun Feb 14 19:47:16 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-shell.mk   Sun Feb 14 20:16:17 2021 +0000
@@ -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:
-       @:;
diff -r 39164c5f74bd -r f6114d7e1d54 usr.bin/make/unit-tests/varmod-sun-shell.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varmod-sun-shell.exp      Sun Feb 14 20:16:17 2021 +0000
@@ -0,0 +1,2 @@
+make: "echo word; false" returned non-zero status
+exit status 0
diff -r 39164c5f74bd -r f6114d7e1d54 usr.bin/make/unit-tests/varmod-sun-shell.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varmod-sun-shell.mk       Sun Feb 14 20:16:17 2021 +0000
@@ -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:



Home | Main Index | Thread Index | Old Index