summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-20 15:06:27 +0000
committerharti <harti@FreeBSD.org>2005-05-20 15:06:27 +0000
commitd35d2dfc6f922b6b000b2f8048534e7afc2997e5 (patch)
tree5194400e3e9746e554711729d82d69913c5577c4 /tools
parentcd2864eb2e7598332d2a84c93a65c6d52675d3b9 (diff)
downloadFreeBSD-src-d35d2dfc6f922b6b000b2f8048534e7afc2997e5.zip
FreeBSD-src-d35d2dfc6f922b6b000b2f8048534e7afc2997e5.tar.gz
Add a test to ensure that in compat mode when a line contains no
shell meta characters it is not passed to the shell, but the command is executed directly (given that the line is not a shell builtin) and that the line with a meta character is passed to the shell.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/usr.bin/make/shell/meta/Makefile30
-rw-r--r--tools/regression/usr.bin/make/shell/meta/expected.status1
-rw-r--r--tools/regression/usr.bin/make/shell/meta/expected.stderr1
-rw-r--r--tools/regression/usr.bin/make/shell/meta/expected.stdout0
-rw-r--r--tools/regression/usr.bin/make/shell/meta/sh.sh6
-rw-r--r--tools/regression/usr.bin/make/shell/meta/test.t13
6 files changed, 51 insertions, 0 deletions
diff --git a/tools/regression/usr.bin/make/shell/meta/Makefile b/tools/regression/usr.bin/make/shell/meta/Makefile
new file mode 100644
index 0000000..28a50d6
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/meta/Makefile
@@ -0,0 +1,30 @@
+#
+# In compat mode (the default without -j) a line that contains no shell
+# meta characters and no shell builtins is not passed to the shell but
+# executed directly. In our example the ls line without meta characters
+# will really execute ls, while the line with meta characters will execute
+# our special shell.
+#
+# $FreeBSD$
+
+all: sh
+ @MAKEFLAGS= ${MAKE} -B no-meta
+ @MAKEFLAGS= ${MAKE} -B meta
+
+sh: sh.sh
+ @cp ${.CURDIR}/sh.sh ${.OBJDIR}/sh
+ @chmod +x ${.OBJDIR}/sh
+
+.ifmake meta || no-meta
+
+.SHELL: path="${.OBJDIR}/sh"
+
+.PHONY: meta no-meta
+
+meta:
+ @ls *
+
+no-meta:
+ @ls -d .
+
+.endif
diff --git a/tools/regression/usr.bin/make/shell/meta/expected.status b/tools/regression/usr.bin/make/shell/meta/expected.status
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/meta/expected.status
@@ -0,0 +1 @@
+2
diff --git a/tools/regression/usr.bin/make/shell/meta/expected.stderr b/tools/regression/usr.bin/make/shell/meta/expected.stderr
new file mode 100644
index 0000000..628ea8f
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/meta/expected.stderr
@@ -0,0 +1 @@
+make: don't know how to make sh.sh. Stop
diff --git a/tools/regression/usr.bin/make/shell/meta/expected.stdout b/tools/regression/usr.bin/make/shell/meta/expected.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/meta/expected.stdout
diff --git a/tools/regression/usr.bin/make/shell/meta/sh.sh b/tools/regression/usr.bin/make/shell/meta/sh.sh
new file mode 100644
index 0000000..3a507b87
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/meta/sh.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo "$@"
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/tools/regression/usr.bin/make/shell/meta/test.t b/tools/regression/usr.bin/make/shell/meta/test.t
new file mode 100644
index 0000000..f67a5c6
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/meta/test.t
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+cd `dirname $0`
+. ../../common.sh
+
+desc_test()
+{
+ echo "Check that a command line with meta characters is passed to the shell."
+}
+
+eval_cmd $1
OpenPOWER on IntegriCloud