summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/tests/shell
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/tests/shell')
-rw-r--r--usr.bin/make/tests/shell/Makefile7
-rw-r--r--usr.bin/make/tests/shell/builtin/Makefile17
-rw-r--r--usr.bin/make/tests/shell/builtin/Makefile.test18
-rw-r--r--usr.bin/make/tests/shell/builtin/expected.status.11
-rw-r--r--usr.bin/make/tests/shell/builtin/expected.status.21
-rw-r--r--usr.bin/make/tests/shell/builtin/expected.stderr.10
-rw-r--r--usr.bin/make/tests/shell/builtin/expected.stderr.20
-rw-r--r--usr.bin/make/tests/shell/builtin/expected.stdout.11
-rw-r--r--usr.bin/make/tests/shell/builtin/expected.stdout.21
-rw-r--r--usr.bin/make/tests/shell/builtin/legacy_test.sh17
-rw-r--r--usr.bin/make/tests/shell/builtin/sh6
-rw-r--r--usr.bin/make/tests/shell/meta/Makefile17
-rw-r--r--usr.bin/make/tests/shell/meta/Makefile.test18
-rw-r--r--usr.bin/make/tests/shell/meta/expected.status.11
-rw-r--r--usr.bin/make/tests/shell/meta/expected.status.21
-rw-r--r--usr.bin/make/tests/shell/meta/expected.stderr.10
-rw-r--r--usr.bin/make/tests/shell/meta/expected.stderr.20
-rw-r--r--usr.bin/make/tests/shell/meta/expected.stdout.11
-rw-r--r--usr.bin/make/tests/shell/meta/expected.stdout.21
-rw-r--r--usr.bin/make/tests/shell/meta/legacy_test.sh17
-rw-r--r--usr.bin/make/tests/shell/meta/sh6
-rw-r--r--usr.bin/make/tests/shell/path/Makefile17
-rw-r--r--usr.bin/make/tests/shell/path/Makefile.test31
-rw-r--r--usr.bin/make/tests/shell/path/expected.status.11
-rw-r--r--usr.bin/make/tests/shell/path/expected.status.21
-rw-r--r--usr.bin/make/tests/shell/path/expected.stderr.10
-rw-r--r--usr.bin/make/tests/shell/path/expected.stderr.20
-rw-r--r--usr.bin/make/tests/shell/path/expected.stdout.11
-rw-r--r--usr.bin/make/tests/shell/path/expected.stdout.21
-rw-r--r--usr.bin/make/tests/shell/path/legacy_test.sh20
-rw-r--r--usr.bin/make/tests/shell/path/sh6
-rw-r--r--usr.bin/make/tests/shell/path_select/Makefile17
-rw-r--r--usr.bin/make/tests/shell/path_select/Makefile.test31
-rw-r--r--usr.bin/make/tests/shell/path_select/expected.status.11
-rw-r--r--usr.bin/make/tests/shell/path_select/expected.status.21
-rw-r--r--usr.bin/make/tests/shell/path_select/expected.stderr.10
-rw-r--r--usr.bin/make/tests/shell/path_select/expected.stderr.20
-rw-r--r--usr.bin/make/tests/shell/path_select/expected.stdout.11
-rw-r--r--usr.bin/make/tests/shell/path_select/expected.stdout.21
-rw-r--r--usr.bin/make/tests/shell/path_select/legacy_test.sh19
-rw-r--r--usr.bin/make/tests/shell/path_select/shell6
-rw-r--r--usr.bin/make/tests/shell/replace/Makefile17
-rw-r--r--usr.bin/make/tests/shell/replace/Makefile.test21
-rw-r--r--usr.bin/make/tests/shell/replace/expected.status.11
-rw-r--r--usr.bin/make/tests/shell/replace/expected.status.21
-rw-r--r--usr.bin/make/tests/shell/replace/expected.stderr.10
-rw-r--r--usr.bin/make/tests/shell/replace/expected.stderr.20
-rw-r--r--usr.bin/make/tests/shell/replace/expected.stdout.13
-rw-r--r--usr.bin/make/tests/shell/replace/expected.stdout.26
-rw-r--r--usr.bin/make/tests/shell/replace/legacy_test.sh17
-rw-r--r--usr.bin/make/tests/shell/replace/shell6
-rw-r--r--usr.bin/make/tests/shell/select/Makefile16
-rw-r--r--usr.bin/make/tests/shell/select/Makefile.test28
-rw-r--r--usr.bin/make/tests/shell/select/expected.status.11
-rw-r--r--usr.bin/make/tests/shell/select/expected.status.21
-rw-r--r--usr.bin/make/tests/shell/select/expected.stderr.10
-rw-r--r--usr.bin/make/tests/shell/select/expected.stderr.20
-rw-r--r--usr.bin/make/tests/shell/select/expected.stdout.11
-rw-r--r--usr.bin/make/tests/shell/select/expected.stdout.21
-rw-r--r--usr.bin/make/tests/shell/select/legacy_test.sh16
60 files changed, 422 insertions, 0 deletions
diff --git a/usr.bin/make/tests/shell/Makefile b/usr.bin/make/tests/shell/Makefile
new file mode 100644
index 0000000..cde8335
--- /dev/null
+++ b/usr.bin/make/tests/shell/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/shell
+
+TESTS_SUBDIRS= builtin meta path path_select replace select
+
+.include <bsd.test.mk>
diff --git a/usr.bin/make/tests/shell/builtin/Makefile b/usr.bin/make/tests/shell/builtin/Makefile
new file mode 100644
index 0000000..3a73215
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/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/make/tests/shell/builtin/Makefile.test b/usr.bin/make/tests/shell/builtin/Makefile.test
new file mode 100644
index 0000000..0376478
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/builtin/expected.status.1 b/usr.bin/make/tests/shell/builtin/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/builtin/expected.status.2 b/usr.bin/make/tests/shell/builtin/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/builtin/expected.stderr.1 b/usr.bin/make/tests/shell/builtin/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/builtin/expected.stderr.2 b/usr.bin/make/tests/shell/builtin/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/builtin/expected.stdout.1 b/usr.bin/make/tests/shell/builtin/expected.stdout.1
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/expected.stdout.1
@@ -0,0 +1 @@
+.
diff --git a/usr.bin/make/tests/shell/builtin/expected.stdout.2 b/usr.bin/make/tests/shell/builtin/expected.stdout.2
new file mode 100644
index 0000000..e350eaf
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/expected.stdout.2
@@ -0,0 +1 @@
+-ec exec ls -d .
diff --git a/usr.bin/make/tests/shell/builtin/legacy_test.sh b/usr.bin/make/tests/shell/builtin/legacy_test.sh
new file mode 100644
index 0000000..6347583
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/builtin/sh b/usr.bin/make/tests/shell/builtin/sh
new file mode 100644
index 0000000..3a507b87
--- /dev/null
+++ b/usr.bin/make/tests/shell/builtin/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo "$@"
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/make/tests/shell/meta/Makefile b/usr.bin/make/tests/shell/meta/Makefile
new file mode 100644
index 0000000..ebd2177
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/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/make/tests/shell/meta/Makefile.test b/usr.bin/make/tests/shell/meta/Makefile.test
new file mode 100644
index 0000000..bcf19d0
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/meta/expected.status.1 b/usr.bin/make/tests/shell/meta/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/meta/expected.status.2 b/usr.bin/make/tests/shell/meta/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/meta/expected.stderr.1 b/usr.bin/make/tests/shell/meta/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/meta/expected.stderr.2 b/usr.bin/make/tests/shell/meta/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/meta/expected.stdout.1 b/usr.bin/make/tests/shell/meta/expected.stdout.1
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/expected.stdout.1
@@ -0,0 +1 @@
+.
diff --git a/usr.bin/make/tests/shell/meta/expected.stdout.2 b/usr.bin/make/tests/shell/meta/expected.stdout.2
new file mode 100644
index 0000000..6ac6f19
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/expected.stdout.2
@@ -0,0 +1 @@
+-ec ls *
diff --git a/usr.bin/make/tests/shell/meta/legacy_test.sh b/usr.bin/make/tests/shell/meta/legacy_test.sh
new file mode 100644
index 0000000..41cd763
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/meta/sh b/usr.bin/make/tests/shell/meta/sh
new file mode 100644
index 0000000..3a507b87
--- /dev/null
+++ b/usr.bin/make/tests/shell/meta/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo "$@"
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/make/tests/shell/path/Makefile b/usr.bin/make/tests/shell/path/Makefile
new file mode 100644
index 0000000..d1eb37a
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/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/make/tests/shell/path/Makefile.test b/usr.bin/make/tests/shell/path/Makefile.test
new file mode 100644
index 0000000..fe40b64
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/path/expected.status.1 b/usr.bin/make/tests/shell/path/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/path/expected.status.2 b/usr.bin/make/tests/shell/path/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/path/expected.stderr.1 b/usr.bin/make/tests/shell/path/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/path/expected.stderr.2 b/usr.bin/make/tests/shell/path/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/path/expected.stdout.1 b/usr.bin/make/tests/shell/path/expected.stdout.1
new file mode 100644
index 0000000..d881364
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/expected.stdout.1
@@ -0,0 +1 @@
+-ec : This is the shell.
diff --git a/usr.bin/make/tests/shell/path/expected.stdout.2 b/usr.bin/make/tests/shell/path/expected.stdout.2
new file mode 100644
index 0000000..de3fc89
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/expected.stdout.2
@@ -0,0 +1 @@
+-ec : This is the C-shell.
diff --git a/usr.bin/make/tests/shell/path/legacy_test.sh b/usr.bin/make/tests/shell/path/legacy_test.sh
new file mode 100644
index 0000000..9289a8d
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/path/sh b/usr.bin/make/tests/shell/path/sh
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/usr.bin/make/tests/shell/path/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo $@
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/make/tests/shell/path_select/Makefile b/usr.bin/make/tests/shell/path_select/Makefile
new file mode 100644
index 0000000..d9341b4
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/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/make/tests/shell/path_select/Makefile.test b/usr.bin/make/tests/shell/path_select/Makefile.test
new file mode 100644
index 0000000..05cfb27
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/path_select/expected.status.1 b/usr.bin/make/tests/shell/path_select/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/path_select/expected.status.2 b/usr.bin/make/tests/shell/path_select/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/path_select/expected.stderr.1 b/usr.bin/make/tests/shell/path_select/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/path_select/expected.stderr.2 b/usr.bin/make/tests/shell/path_select/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/path_select/expected.stdout.1 b/usr.bin/make/tests/shell/path_select/expected.stdout.1
new file mode 100644
index 0000000..d881364
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/expected.stdout.1
@@ -0,0 +1 @@
+-ec : This is the shell.
diff --git a/usr.bin/make/tests/shell/path_select/expected.stdout.2 b/usr.bin/make/tests/shell/path_select/expected.stdout.2
new file mode 100644
index 0000000..de3fc89
--- /dev/null
+++ b/usr.bin/make/tests/shell/path_select/expected.stdout.2
@@ -0,0 +1 @@
+-ec : This is the C-shell.
diff --git a/usr.bin/make/tests/shell/path_select/legacy_test.sh b/usr.bin/make/tests/shell/path_select/legacy_test.sh
new file mode 100644
index 0000000..6b75b90
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/path_select/shell b/usr.bin/make/tests/shell/path_select/shell
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/replace/Makefile b/usr.bin/make/tests/shell/replace/Makefile
new file mode 100644
index 0000000..7c64d72
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/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/make/tests/shell/replace/Makefile.test b/usr.bin/make/tests/shell/replace/Makefile.test
new file mode 100644
index 0000000..2160dbf
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/replace/expected.status.1 b/usr.bin/make/tests/shell/replace/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/replace/expected.status.2 b/usr.bin/make/tests/shell/replace/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/replace/expected.stderr.1 b/usr.bin/make/tests/shell/replace/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/replace/expected.stderr.2 b/usr.bin/make/tests/shell/replace/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/replace/expected.stdout.1 b/usr.bin/make/tests/shell/replace/expected.stdout.1
new file mode 100644
index 0000000..eff99ea
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/expected.stdout.1
@@ -0,0 +1,3 @@
+-c funny $
+funnier $
+-ec funnier $
diff --git a/usr.bin/make/tests/shell/replace/expected.stdout.2 b/usr.bin/make/tests/shell/replace/expected.stdout.2
new file mode 100644
index 0000000..c79a09a
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/expected.stdout.2
@@ -0,0 +1,6 @@
+-yx
+be quiet
+ignore errors
+funny $
+check errors
+funnier $
diff --git a/usr.bin/make/tests/shell/replace/legacy_test.sh b/usr.bin/make/tests/shell/replace/legacy_test.sh
new file mode 100644
index 0000000..880ca78
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/replace/shell b/usr.bin/make/tests/shell/replace/shell
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/usr.bin/make/tests/shell/replace/shell
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo $@
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/make/tests/shell/select/Makefile b/usr.bin/make/tests/shell/select/Makefile
new file mode 100644
index 0000000..85486c6
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/make/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/make/tests/shell/select/Makefile.test b/usr.bin/make/tests/shell/select/Makefile.test
new file mode 100644
index 0000000..74d96e1
--- /dev/null
+++ b/usr.bin/make/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/make/tests/shell/select/expected.status.1 b/usr.bin/make/tests/shell/select/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/select/expected.status.2 b/usr.bin/make/tests/shell/select/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/make/tests/shell/select/expected.stderr.1 b/usr.bin/make/tests/shell/select/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/select/expected.stderr.2 b/usr.bin/make/tests/shell/select/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/select/expected.stdout.1 b/usr.bin/make/tests/shell/select/expected.stdout.1
new file mode 100644
index 0000000..c2cdaa0
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/expected.stdout.1
@@ -0,0 +1 @@
+/bin/sh
diff --git a/usr.bin/make/tests/shell/select/expected.stdout.2 b/usr.bin/make/tests/shell/select/expected.stdout.2
new file mode 100644
index 0000000..5a831e8
--- /dev/null
+++ b/usr.bin/make/tests/shell/select/expected.stdout.2
@@ -0,0 +1 @@
+/bin/csh
diff --git a/usr.bin/make/tests/shell/select/legacy_test.sh b/usr.bin/make/tests/shell/select/legacy_test.sh
new file mode 100644
index 0000000..46d3eaf
--- /dev/null
+++ b/usr.bin/make/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 $*
OpenPOWER on IntegriCloud