diff options
author | harti <harti@FreeBSD.org> | 2005-05-20 15:25:04 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-05-20 15:25:04 +0000 |
commit | e533045bcd0864cf0ff78791d82adf7264aa4594 (patch) | |
tree | 9e1937b9b08ad08fd153d31b876cd2d1ae9f2d63 /tools | |
parent | b618326a09ec1f8bd6f32814ceeb8a6dad46bed5 (diff) | |
download | FreeBSD-src-e533045bcd0864cf0ff78791d82adf7264aa4594.zip FreeBSD-src-e533045bcd0864cf0ff78791d82adf7264aa4594.tar.gz |
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.
Diffstat (limited to 'tools')
6 files changed, 51 insertions, 0 deletions
diff --git a/tools/regression/usr.bin/make/shell/builtin/Makefile b/tools/regression/usr.bin/make/shell/builtin/Makefile new file mode 100644 index 0000000..6fe42ab --- /dev/null +++ b/tools/regression/usr.bin/make/shell/builtin/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-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 diff --git a/tools/regression/usr.bin/make/shell/builtin/expected.status b/tools/regression/usr.bin/make/shell/builtin/expected.status new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tools/regression/usr.bin/make/shell/builtin/expected.status @@ -0,0 +1 @@ +2 diff --git a/tools/regression/usr.bin/make/shell/builtin/expected.stderr b/tools/regression/usr.bin/make/shell/builtin/expected.stderr new file mode 100644 index 0000000..628ea8f --- /dev/null +++ b/tools/regression/usr.bin/make/shell/builtin/expected.stderr @@ -0,0 +1 @@ +make: don't know how to make sh.sh. Stop diff --git a/tools/regression/usr.bin/make/shell/builtin/expected.stdout b/tools/regression/usr.bin/make/shell/builtin/expected.stdout new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tools/regression/usr.bin/make/shell/builtin/expected.stdout diff --git a/tools/regression/usr.bin/make/shell/builtin/sh.sh b/tools/regression/usr.bin/make/shell/builtin/sh.sh new file mode 100644 index 0000000..3a507b87 --- /dev/null +++ b/tools/regression/usr.bin/make/shell/builtin/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/builtin/test.t b/tools/regression/usr.bin/make/shell/builtin/test.t new file mode 100644 index 0000000..a20fb2a --- /dev/null +++ b/tools/regression/usr.bin/make/shell/builtin/test.t @@ -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 |