aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2021-01-03 20:27:50 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2021-01-30 15:10:26 +0000
commitc48240fa6f8e168325a278f8b8cc075779615ddf (patch)
treebb8573679fb01f8da39e9e3b06c9e82bf36c85d5
parent3708b615c354df013037c065d5a714207c041ea8 (diff)
downloadsrc-c48240fa6f8e168325a278f8b8cc075779615ddf.tar.gz
src-c48240fa6f8e168325a278f8b8cc075779615ddf.zip
sh/tests: Add a second kind of binary scripts without #!
One of the reasons for git commit e0f5c1387df23c8c4811f5b24a7ef6ecac51a71a was to make "actually portable executables" work. Add a test that is more like those. MFC after: 1 week (cherry picked from commit 52981a1694be7a70013e5149c020706c9b6411f9)
-rw-r--r--bin/sh/tests/execution/Makefile1
-rw-r--r--bin/sh/tests/execution/shellproc7.010
2 files changed, 11 insertions, 0 deletions
diff --git a/bin/sh/tests/execution/Makefile b/bin/sh/tests/execution/Makefile
index c7f68a7404aa..ddf2ff7f53b6 100644
--- a/bin/sh/tests/execution/Makefile
+++ b/bin/sh/tests/execution/Makefile
@@ -61,6 +61,7 @@ ${PACKAGE}FILES+= shellproc3.0
${PACKAGE}FILES+= shellproc4.0
${PACKAGE}FILES+= shellproc5.0
${PACKAGE}FILES+= shellproc6.0
+${PACKAGE}FILES+= shellproc7.0
${PACKAGE}FILES+= subshell1.0 subshell1.0.stdout
${PACKAGE}FILES+= subshell2.0
${PACKAGE}FILES+= subshell3.0
diff --git a/bin/sh/tests/execution/shellproc7.0 b/bin/sh/tests/execution/shellproc7.0
new file mode 100644
index 000000000000..2a99ae74c151
--- /dev/null
+++ b/bin/sh/tests/execution/shellproc7.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+# Non-POSIX trickery that is widely supported,
+# used by https://justine.lol/ape.html
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+printf "MZqFpD='\n\0'\n#'\"\necho this is a test\n" >"$T/testshellproc"
+chmod 755 "$T/testshellproc"
+PATH=$T:$PATH
+[ "`testshellproc`" = "this is a test" ]