sh/tests: Add a second kind of binary scripts without #!

One of the reasons for git commit
e0f5c1387d was to make "actually portable
executables" work. Add a test that is more like those.

MFC after:	1 week
This commit is contained in:
Jilles Tjoelker 2021-01-03 21:27:50 +01:00
parent c949ba1d20
commit 52981a1694
2 changed files with 11 additions and 0 deletions

View file

@ -63,6 +63,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

View file

@ -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" ]