diff options
| author | Julio Merino <jmmv@FreeBSD.org> | 2014-05-14 18:43:13 +0000 |
|---|---|---|
| committer | Julio Merino <jmmv@FreeBSD.org> | 2014-05-14 18:43:13 +0000 |
| commit | 5ae59dec60e3815b621ae87f74a377cf3449ca55 (patch) | |
| tree | 5f8bd4d7669fed59fe6c95a88d3b3489b23849e8 /usr.bin/bmake/tests/shell | |
| parent | a9069ffab45e259fbbc5626ee11fd3215bf0e399 (diff) | |
Notes
Diffstat (limited to 'usr.bin/bmake/tests/shell')
60 files changed, 422 insertions, 0 deletions
diff --git a/usr.bin/bmake/tests/shell/Makefile b/usr.bin/bmake/tests/shell/Makefile new file mode 100644 index 0000000000000..13b570ea64dbd --- /dev/null +++ b/usr.bin/bmake/tests/shell/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell + +TESTS_SUBDIRS= builtin meta path path_select replace select + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/builtin/Makefile b/usr.bin/bmake/tests/shell/builtin/Makefile new file mode 100644 index 0000000000000..cd458a973e507 --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/builtin + +TAP_TESTS_SH= legacy_test + +FILESDIR= ${TESTSDIR} +FILES= Makefile.test +FILES+= expected.status.1 +FILES+= expected.status.2 +FILES+= expected.stderr.1 +FILES+= expected.stderr.2 +FILES+= expected.stdout.1 +FILES+= expected.stdout.2 +FILES+= sh + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/builtin/Makefile.test b/usr.bin/bmake/tests/shell/builtin/Makefile.test new file mode 100644 index 0000000000000..03764784e1a09 --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/Makefile.test @@ -0,0 +1,18 @@ +# +# 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$ + +.SHELL: path="${.CURDIR}/sh" + +.PHONY: builtin no-builtin + +builtin: + @exec ls -d . + +no-builtin: + @ls -d . diff --git a/usr.bin/bmake/tests/shell/builtin/expected.status.1 b/usr.bin/bmake/tests/shell/builtin/expected.status.1 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/expected.status.1 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/builtin/expected.status.2 b/usr.bin/bmake/tests/shell/builtin/expected.status.2 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/expected.status.2 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stderr.1 b/usr.bin/bmake/tests/shell/builtin/expected.stderr.1 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/expected.stderr.1 diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stderr.2 b/usr.bin/bmake/tests/shell/builtin/expected.stderr.2 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/expected.stderr.2 diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stdout.1 b/usr.bin/bmake/tests/shell/builtin/expected.stdout.1 new file mode 100644 index 0000000000000..9c558e357c416 --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/expected.stdout.1 @@ -0,0 +1 @@ +. diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stdout.2 b/usr.bin/bmake/tests/shell/builtin/expected.stdout.2 new file mode 100644 index 0000000000000..e350eaf8c7ea9 --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/expected.stdout.2 @@ -0,0 +1 @@ +-ec exec ls -d . diff --git a/usr.bin/bmake/tests/shell/builtin/legacy_test.sh b/usr.bin/bmake/tests/shell/builtin/legacy_test.sh new file mode 100644 index 0000000000000..6347583faeb69 --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/legacy_test.sh @@ -0,0 +1,17 @@ +#! /bin/sh +# $FreeBSD$ + +. $(dirname $0)/../../common.sh + +# Description +DESC="Check that a command line with a builtin is passed to the shell." + +# Setup +TEST_COPY_FILES="sh 755" + +# Run +TEST_N=2 +TEST_1="-B no-builtin" +TEST_2="-B builtin" + +eval_cmd $* diff --git a/usr.bin/bmake/tests/shell/builtin/sh b/usr.bin/bmake/tests/shell/builtin/sh new file mode 100644 index 0000000000000..3a507b87f6748 --- /dev/null +++ b/usr.bin/bmake/tests/shell/builtin/sh @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ +echo "$@" +if ! test -t 0 ; then + cat +fi diff --git a/usr.bin/bmake/tests/shell/meta/Makefile b/usr.bin/bmake/tests/shell/meta/Makefile new file mode 100644 index 0000000000000..b342e79e3cf35 --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/meta + +TAP_TESTS_SH= legacy_test + +FILESDIR= ${TESTSDIR} +FILES= Makefile.test +FILES+= expected.status.1 +FILES+= expected.status.2 +FILES+= expected.stderr.1 +FILES+= expected.stderr.2 +FILES+= expected.stdout.1 +FILES+= expected.stdout.2 +FILES+= sh + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/meta/Makefile.test b/usr.bin/bmake/tests/shell/meta/Makefile.test new file mode 100644 index 0000000000000..bcf19d052bbc7 --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/Makefile.test @@ -0,0 +1,18 @@ +# +# 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$ + +.SHELL: path="${.OBJDIR}/sh" + +.PHONY: meta no-meta + +meta: + @ls * + +no-meta: + @ls -d . diff --git a/usr.bin/bmake/tests/shell/meta/expected.status.1 b/usr.bin/bmake/tests/shell/meta/expected.status.1 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/expected.status.1 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/meta/expected.status.2 b/usr.bin/bmake/tests/shell/meta/expected.status.2 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/expected.status.2 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/meta/expected.stderr.1 b/usr.bin/bmake/tests/shell/meta/expected.stderr.1 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/expected.stderr.1 diff --git a/usr.bin/bmake/tests/shell/meta/expected.stderr.2 b/usr.bin/bmake/tests/shell/meta/expected.stderr.2 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/expected.stderr.2 diff --git a/usr.bin/bmake/tests/shell/meta/expected.stdout.1 b/usr.bin/bmake/tests/shell/meta/expected.stdout.1 new file mode 100644 index 0000000000000..9c558e357c416 --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/expected.stdout.1 @@ -0,0 +1 @@ +. diff --git a/usr.bin/bmake/tests/shell/meta/expected.stdout.2 b/usr.bin/bmake/tests/shell/meta/expected.stdout.2 new file mode 100644 index 0000000000000..6ac6f19502a5f --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/expected.stdout.2 @@ -0,0 +1 @@ +-ec ls * diff --git a/usr.bin/bmake/tests/shell/meta/legacy_test.sh b/usr.bin/bmake/tests/shell/meta/legacy_test.sh new file mode 100644 index 0000000000000..41cd763fd7dd2 --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/legacy_test.sh @@ -0,0 +1,17 @@ +#! /bin/sh +# $FreeBSD$ + +. $(dirname $0)/../../common.sh + +# Description +DESC="Check that a command line with meta characters is passed to the shell." + +# Setup +TEST_COPY_FILES="sh 755" + +# Run +TEST_N=2 +TEST_1="-B no-meta" +TEST_2="-B meta" + +eval_cmd $* diff --git a/usr.bin/bmake/tests/shell/meta/sh b/usr.bin/bmake/tests/shell/meta/sh new file mode 100644 index 0000000000000..3a507b87f6748 --- /dev/null +++ b/usr.bin/bmake/tests/shell/meta/sh @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ +echo "$@" +if ! test -t 0 ; then + cat +fi diff --git a/usr.bin/bmake/tests/shell/path/Makefile b/usr.bin/bmake/tests/shell/path/Makefile new file mode 100644 index 0000000000000..5a83a1ff6adcf --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/path + +TAP_TESTS_SH= legacy_test + +FILESDIR= ${TESTSDIR} +FILES= Makefile.test +FILES+= expected.status.1 +FILES+= expected.status.2 +FILES+= expected.stderr.1 +FILES+= expected.stderr.2 +FILES+= expected.stdout.1 +FILES+= expected.stdout.2 +FILES+= sh + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/path/Makefile.test b/usr.bin/bmake/tests/shell/path/Makefile.test new file mode 100644 index 0000000000000..fe40b645510ec --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/Makefile.test @@ -0,0 +1,31 @@ +# +# Change the path for builtin shells. There are two methods to do this. +# This is the first of them when the basename of the path is equal to +# one of the builtin shells so that the .SHELL target automatically +# also selectes the shell without specifying the name. +# +# Be sure to include a meta-character into the command line, so that +# really our shell is executed. +# +# $FreeBSD$ +# + +.ifmake sh_test + +.SHELL: path=${.OBJDIR}/sh +sh_test: + @: This is the shell. + +.elifmake csh_test + +.SHELL: path=${.OBJDIR}/csh +csh_test: + @: This is the C-shell. + +.elifmake ksh_test + +.SHELL: path=${.OBJDIR}/ksh +ksh_test: + @: This is the Korn-shell. + +.endif diff --git a/usr.bin/bmake/tests/shell/path/expected.status.1 b/usr.bin/bmake/tests/shell/path/expected.status.1 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/expected.status.1 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/path/expected.status.2 b/usr.bin/bmake/tests/shell/path/expected.status.2 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/expected.status.2 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/path/expected.stderr.1 b/usr.bin/bmake/tests/shell/path/expected.stderr.1 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/expected.stderr.1 diff --git a/usr.bin/bmake/tests/shell/path/expected.stderr.2 b/usr.bin/bmake/tests/shell/path/expected.stderr.2 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/expected.stderr.2 diff --git a/usr.bin/bmake/tests/shell/path/expected.stdout.1 b/usr.bin/bmake/tests/shell/path/expected.stdout.1 new file mode 100644 index 0000000000000..d881364744b27 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/expected.stdout.1 @@ -0,0 +1 @@ +-ec : This is the shell. diff --git a/usr.bin/bmake/tests/shell/path/expected.stdout.2 b/usr.bin/bmake/tests/shell/path/expected.stdout.2 new file mode 100644 index 0000000000000..de3fc89cc9e21 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/expected.stdout.2 @@ -0,0 +1 @@ +-ec : This is the C-shell. diff --git a/usr.bin/bmake/tests/shell/path/legacy_test.sh b/usr.bin/bmake/tests/shell/path/legacy_test.sh new file mode 100644 index 0000000000000..9289a8d2dddd5 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/legacy_test.sh @@ -0,0 +1,20 @@ +#! /bin/sh +# $FreeBSD$ + +. $(dirname $0)/../../common.sh + +# Description +DESC="New path for builtin shells." + +# Setup +TEST_COPY_FILES="sh 755" +TEST_LINKS="sh csh sh ksh" + +# Run +TEST_N=3 +TEST_1="sh_test" +TEST_2="csh_test" +TEST_3="ksh_test" +TEST_3_SKIP="no ksh on FreeBSD" + +eval_cmd $* diff --git a/usr.bin/bmake/tests/shell/path/sh b/usr.bin/bmake/tests/shell/path/sh new file mode 100644 index 0000000000000..46169eb6efc2b --- /dev/null +++ b/usr.bin/bmake/tests/shell/path/sh @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ +echo $@ +if ! test -t 0 ; then + cat +fi diff --git a/usr.bin/bmake/tests/shell/path_select/Makefile b/usr.bin/bmake/tests/shell/path_select/Makefile new file mode 100644 index 0000000000000..1819f910a12a7 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/path_select + +TAP_TESTS_SH= legacy_test + +FILESDIR= ${TESTSDIR} +FILES= Makefile.test +FILES+= expected.status.1 +FILES+= expected.status.2 +FILES+= expected.stderr.1 +FILES+= expected.stderr.2 +FILES+= expected.stdout.1 +FILES+= expected.stdout.2 +FILES+= shell + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/path_select/Makefile.test b/usr.bin/bmake/tests/shell/path_select/Makefile.test new file mode 100644 index 0000000000000..05cfb27f3fd9a --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/Makefile.test @@ -0,0 +1,31 @@ +# +# Change the path for builtin shells. There are two methods to do this. +# This is the second of them when both a path and a name are specified. +# This selects a builtin shell according to the name, but executes it +# from the specified path. +# +# Be sure to include a meta-character into the command line, so that +# really our shell is executed. +# +# $FreeBSD$ +# + +.ifmake sh_test + +.SHELL: name=sh path=${.CURDIR}/shell +sh_test: + @: This is the shell. + +.elifmake csh_test + +.SHELL: name=csh path=${.CURDIR}/shell +csh_test: + @: This is the C-shell. + +.elifmake ksh_test + +.SHELL: name=ksh path=${.CURDIR}/shell +ksh_test: + @: This is the Korn-shell. + +.endif diff --git a/usr.bin/bmake/tests/shell/path_select/expected.status.1 b/usr.bin/bmake/tests/shell/path_select/expected.status.1 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/expected.status.1 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/path_select/expected.status.2 b/usr.bin/bmake/tests/shell/path_select/expected.status.2 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/expected.status.2 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stderr.1 b/usr.bin/bmake/tests/shell/path_select/expected.stderr.1 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/expected.stderr.1 diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stderr.2 b/usr.bin/bmake/tests/shell/path_select/expected.stderr.2 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/expected.stderr.2 diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stdout.1 b/usr.bin/bmake/tests/shell/path_select/expected.stdout.1 new file mode 100644 index 0000000000000..d881364744b27 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/expected.stdout.1 @@ -0,0 +1 @@ +-ec : This is the shell. diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stdout.2 b/usr.bin/bmake/tests/shell/path_select/expected.stdout.2 new file mode 100644 index 0000000000000..de3fc89cc9e21 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/expected.stdout.2 @@ -0,0 +1 @@ +-ec : This is the C-shell. diff --git a/usr.bin/bmake/tests/shell/path_select/legacy_test.sh b/usr.bin/bmake/tests/shell/path_select/legacy_test.sh new file mode 100644 index 0000000000000..6b75b900e4387 --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/legacy_test.sh @@ -0,0 +1,19 @@ +#! /bin/sh +# $FreeBSD$ + +. $(dirname $0)/../../common.sh + +# Description +DESC="New path for builtin shells (2)." + +# Setup +TEST_COPY_FILES="shell 755" + +# Run +TEST_N=3 +TEST_1="sh_test" +TEST_2="csh_test" +TEST_3="ksh_test" +TEST_3_SKIP="no ksh on FreeBSD" + +eval_cmd $* diff --git a/usr.bin/bmake/tests/shell/path_select/shell b/usr.bin/bmake/tests/shell/path_select/shell new file mode 100644 index 0000000000000..46169eb6efc2b --- /dev/null +++ b/usr.bin/bmake/tests/shell/path_select/shell @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ +echo $@ +if ! test -t 0 ; then + cat +fi diff --git a/usr.bin/bmake/tests/shell/replace/Makefile b/usr.bin/bmake/tests/shell/replace/Makefile new file mode 100644 index 0000000000000..0dae9154bf33a --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/replace + +TAP_TESTS_SH= legacy_test + +FILESDIR= ${TESTSDIR} +FILES= Makefile.test +FILES+= expected.status.1 +FILES+= expected.status.2 +FILES+= expected.stderr.1 +FILES+= expected.stderr.2 +FILES+= expected.stdout.1 +FILES+= expected.stdout.2 +FILES+= shell + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/replace/Makefile.test b/usr.bin/bmake/tests/shell/replace/Makefile.test new file mode 100644 index 0000000000000..2160dbfb57762 --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/Makefile.test @@ -0,0 +1,21 @@ +# +# Test that we can replace the shell and set all the shell parameters +# (except meta and builtin which have their own test). This is done by +# using a shell script for the shell that echoes all command line +# arguments and its standard input. The shell name should not be one of +# the builtin shells. +# +# XXX There seems to be a problem here in -j1 mode: for the line without +# @- make should switch on echoing again, but it doesn't. +# +# $FreeBSD$ + +.SHELL: name="shell" path="${.CURDIR}/shell" \ + quiet="be quiet" echo="be verbose" filter="be verbose" \ + echoFlag="x" errFlag="y" \ + hasErrCtl=y check="check errors" ignore="ignore errors" + +.PHONY: test1 +test1: + -@funny $$ + funnier $$ diff --git a/usr.bin/bmake/tests/shell/replace/expected.status.1 b/usr.bin/bmake/tests/shell/replace/expected.status.1 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/expected.status.1 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/replace/expected.status.2 b/usr.bin/bmake/tests/shell/replace/expected.status.2 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/expected.status.2 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/replace/expected.stderr.1 b/usr.bin/bmake/tests/shell/replace/expected.stderr.1 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/expected.stderr.1 diff --git a/usr.bin/bmake/tests/shell/replace/expected.stderr.2 b/usr.bin/bmake/tests/shell/replace/expected.stderr.2 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/expected.stderr.2 diff --git a/usr.bin/bmake/tests/shell/replace/expected.stdout.1 b/usr.bin/bmake/tests/shell/replace/expected.stdout.1 new file mode 100644 index 0000000000000..eff99ea17ab2a --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/expected.stdout.1 @@ -0,0 +1,3 @@ +-c funny $ +funnier $ +-ec funnier $ diff --git a/usr.bin/bmake/tests/shell/replace/expected.stdout.2 b/usr.bin/bmake/tests/shell/replace/expected.stdout.2 new file mode 100644 index 0000000000000..c79a09af29165 --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/expected.stdout.2 @@ -0,0 +1,6 @@ +-yx +be quiet +ignore errors +funny $ +check errors +funnier $ diff --git a/usr.bin/bmake/tests/shell/replace/legacy_test.sh b/usr.bin/bmake/tests/shell/replace/legacy_test.sh new file mode 100644 index 0000000000000..880ca780d53b9 --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/legacy_test.sh @@ -0,0 +1,17 @@ +#! /bin/sh +# $FreeBSD$ + +. $(dirname $0)/../../common.sh + +# Description +DESC="Check that the shell can be replaced." + +# Setup +TEST_COPY_FILES="shell 755" + +# Run +TEST_N=2 +TEST_1= +TEST_2=-j2 + +eval_cmd $* diff --git a/usr.bin/bmake/tests/shell/replace/shell b/usr.bin/bmake/tests/shell/replace/shell new file mode 100644 index 0000000000000..46169eb6efc2b --- /dev/null +++ b/usr.bin/bmake/tests/shell/replace/shell @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ +echo $@ +if ! test -t 0 ; then + cat +fi diff --git a/usr.bin/bmake/tests/shell/select/Makefile b/usr.bin/bmake/tests/shell/select/Makefile new file mode 100644 index 0000000000000..45e6d72b6cdea --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/select + +TAP_TESTS_SH= legacy_test + +FILESDIR= ${TESTSDIR} +FILES= Makefile.test +FILES+= expected.status.1 +FILES+= expected.status.2 +FILES+= expected.stderr.1 +FILES+= expected.stderr.2 +FILES+= expected.stdout.1 +FILES+= expected.stdout.2 + +.include <bsd.test.mk> diff --git a/usr.bin/bmake/tests/shell/select/Makefile.test b/usr.bin/bmake/tests/shell/select/Makefile.test new file mode 100644 index 0000000000000..74d96e1d445ba --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/Makefile.test @@ -0,0 +1,28 @@ +# +# We just select the builtin shells and check whether it is really +# executed. This should print just the shell paths. Because we +# normally don't have a ksh, we make this test conditional. This means +# one has to recreate the test results once ksh is installed. +# +# $FreeBSD$ +# + +.ifmake sh_test + +.SHELL: name=sh +sh_test: print_path + +.elifmake csh_test + +.SHELL: name=csh +csh_test: print_path + +.elifmake ksh_test + +.SHELL: name=ksh +ksh_test: print_path + +.endif + +print_path: + @ps -x -opid,command | awk '$$1=='$$$$' { print $$2; }' diff --git a/usr.bin/bmake/tests/shell/select/expected.status.1 b/usr.bin/bmake/tests/shell/select/expected.status.1 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/expected.status.1 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/select/expected.status.2 b/usr.bin/bmake/tests/shell/select/expected.status.2 new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/expected.status.2 @@ -0,0 +1 @@ +0 diff --git a/usr.bin/bmake/tests/shell/select/expected.stderr.1 b/usr.bin/bmake/tests/shell/select/expected.stderr.1 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/expected.stderr.1 diff --git a/usr.bin/bmake/tests/shell/select/expected.stderr.2 b/usr.bin/bmake/tests/shell/select/expected.stderr.2 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/expected.stderr.2 diff --git a/usr.bin/bmake/tests/shell/select/expected.stdout.1 b/usr.bin/bmake/tests/shell/select/expected.stdout.1 new file mode 100644 index 0000000000000..c2cdaa0f27c1a --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/expected.stdout.1 @@ -0,0 +1 @@ +/bin/sh diff --git a/usr.bin/bmake/tests/shell/select/expected.stdout.2 b/usr.bin/bmake/tests/shell/select/expected.stdout.2 new file mode 100644 index 0000000000000..5a831e82da122 --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/expected.stdout.2 @@ -0,0 +1 @@ +/bin/csh diff --git a/usr.bin/bmake/tests/shell/select/legacy_test.sh b/usr.bin/bmake/tests/shell/select/legacy_test.sh new file mode 100644 index 0000000000000..46d3eafe571b2 --- /dev/null +++ b/usr.bin/bmake/tests/shell/select/legacy_test.sh @@ -0,0 +1,16 @@ +#! /bin/sh +# $FreeBSD$ + +. $(dirname $0)/../../common.sh + +# Description +DESC="Select the builtin sh shell." + +# Run +TEST_N=3 +TEST_1="sh_test" +TEST_2="csh_test" +TEST_3="ksh_test" +TEST_3_SKIP="no ksh on FreeBSD" + +eval_cmd $* |
