Add a test to check whether in compat mode make detectes builtins
on the command line and really executes the shell instead of directly executing the command.
This commit is contained in:
parent
b618326a09
commit
e533045bcd
30
tools/regression/usr.bin/make/shell/builtin/Makefile
Normal file
30
tools/regression/usr.bin/make/shell/builtin/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-builtin
|
||||
@MAKEFLAGS= ${MAKE} -B builtin
|
||||
|
||||
sh: sh.sh
|
||||
@cp ${.CURDIR}/sh.sh ${.OBJDIR}/sh
|
||||
@chmod +x ${.OBJDIR}/sh
|
||||
|
||||
.ifmake builtin || no-builtin
|
||||
|
||||
.SHELL: path="${.OBJDIR}/sh"
|
||||
|
||||
.PHONY: builtin no-builtin
|
||||
|
||||
builtin:
|
||||
@exec ls -d .
|
||||
|
||||
no-builtin:
|
||||
@ls -d .
|
||||
|
||||
.endif
|
@ -0,0 +1 @@
|
||||
2
|
@ -0,0 +1 @@
|
||||
make: don't know how to make sh.sh. Stop
|
6
tools/regression/usr.bin/make/shell/builtin/sh.sh
Normal file
6
tools/regression/usr.bin/make/shell/builtin/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/builtin/test.t
Normal file
13
tools/regression/usr.bin/make/shell/builtin/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 a builtin is passed to the shell."
|
||||
}
|
||||
|
||||
eval_cmd $1
|
Loading…
x
Reference in New Issue
Block a user