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.
This commit is contained in:
parent
532e65b886
commit
ac8946e3d3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146452
30
tools/regression/usr.bin/make/shell/meta/Makefile
Normal file
30
tools/regression/usr.bin/make/shell/meta/Makefile
Normal file
@ -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
|
1
tools/regression/usr.bin/make/shell/meta/expected.status
Normal file
1
tools/regression/usr.bin/make/shell/meta/expected.status
Normal file
@ -0,0 +1 @@
|
||||
2
|
1
tools/regression/usr.bin/make/shell/meta/expected.stderr
Normal file
1
tools/regression/usr.bin/make/shell/meta/expected.stderr
Normal file
@ -0,0 +1 @@
|
||||
make: don't know how to make sh.sh. Stop
|
6
tools/regression/usr.bin/make/shell/meta/sh.sh
Normal file
6
tools/regression/usr.bin/make/shell/meta/sh.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
echo "$@"
|
||||
if ! test -t 0 ; then
|
||||
cat
|
||||
fi
|
13
tools/regression/usr.bin/make/shell/meta/test.t
Normal file
13
tools/regression/usr.bin/make/shell/meta/test.t
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user