summaryrefslogtreecommitdiffstats
path: root/tools/regression/usr.bin
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-19 11:23:01 +0000
committerharti <harti@FreeBSD.org>2005-05-19 11:23:01 +0000
commitb2f252c7bc199c1eab693e75006fd228849a5672 (patch)
treeff115f1ab9e55fe67334f2dd06af3fbadd5f474f /tools/regression/usr.bin
parentb51d8499fe80381c2d42f6a720e0bc4896063514 (diff)
downloadFreeBSD-src-b2f252c7bc199c1eab693e75006fd228849a5672.zip
FreeBSD-src-b2f252c7bc199c1eab693e75006fd228849a5672.tar.gz
Some test cases for .SHELL target: builtin shell selection and
changing the path of a builtin shell.
Diffstat (limited to 'tools/regression/usr.bin')
-rw-r--r--tools/regression/usr.bin/make/shell/path/Makefile48
-rw-r--r--tools/regression/usr.bin/make/shell/path/expected.status1
-rw-r--r--tools/regression/usr.bin/make/shell/path/expected.stderr1
-rw-r--r--tools/regression/usr.bin/make/shell/path/expected.stdout0
-rw-r--r--tools/regression/usr.bin/make/shell/path/sh.sh6
-rw-r--r--tools/regression/usr.bin/make/shell/path/test.t13
-rw-r--r--tools/regression/usr.bin/make/shell/path_select/Makefile40
-rw-r--r--tools/regression/usr.bin/make/shell/path_select/expected.status1
-rw-r--r--tools/regression/usr.bin/make/shell/path_select/expected.stderr1
-rw-r--r--tools/regression/usr.bin/make/shell/path_select/expected.stdout0
-rw-r--r--tools/regression/usr.bin/make/shell/path_select/sh.sh6
-rw-r--r--tools/regression/usr.bin/make/shell/path_select/test.t13
-rw-r--r--tools/regression/usr.bin/make/shell/select/Makefile33
-rw-r--r--tools/regression/usr.bin/make/shell/select/expected.status1
-rw-r--r--tools/regression/usr.bin/make/shell/select/expected.stderr0
-rw-r--r--tools/regression/usr.bin/make/shell/select/expected.stdout2
-rw-r--r--tools/regression/usr.bin/make/shell/select/test.t13
17 files changed, 179 insertions, 0 deletions
diff --git a/tools/regression/usr.bin/make/shell/path/Makefile b/tools/regression/usr.bin/make/shell/path/Makefile
new file mode 100644
index 0000000..8b1ce1b
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path/Makefile
@@ -0,0 +1,48 @@
+#
+# 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$
+#
+
+all: sh csh ksh
+ @${MAKE} sh_test
+ @${MAKE} csh_test
+ @if [ -x /bin/ksh ] ; then ${MAKE} ksh_test ; fi
+
+sh: sh.sh
+ @cp ${.CURDIR}/sh.sh ${.OBJDIR}/sh
+ @chmod +x ${.OBJDIR}/sh
+
+csh: sh.sh
+ @cp ${.CURDIR}/sh.sh ${.OBJDIR}/csh
+ @chmod +x ${.OBJDIR}/csh
+
+ksh: sh.sh
+ @cp ${.CURDIR}/sh.sh ${.OBJDIR}/ksh
+ @chmod +x ${.OBJDIR}/ksh
+
+.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/tools/regression/usr.bin/make/shell/path/expected.status b/tools/regression/usr.bin/make/shell/path/expected.status
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path/expected.status
@@ -0,0 +1 @@
+2
diff --git a/tools/regression/usr.bin/make/shell/path/expected.stderr b/tools/regression/usr.bin/make/shell/path/expected.stderr
new file mode 100644
index 0000000..628ea8f
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path/expected.stderr
@@ -0,0 +1 @@
+make: don't know how to make sh.sh. Stop
diff --git a/tools/regression/usr.bin/make/shell/path/expected.stdout b/tools/regression/usr.bin/make/shell/path/expected.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path/expected.stdout
diff --git a/tools/regression/usr.bin/make/shell/path/sh.sh b/tools/regression/usr.bin/make/shell/path/sh.sh
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path/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/path/test.t b/tools/regression/usr.bin/make/shell/path/test.t
new file mode 100644
index 0000000..890fb45
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path/test.t
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+cd `dirname $0`
+. ../../common.sh
+
+desc_test()
+{
+ echo "New path for builtin shells."
+}
+
+eval_cmd $1
diff --git a/tools/regression/usr.bin/make/shell/path_select/Makefile b/tools/regression/usr.bin/make/shell/path_select/Makefile
new file mode 100644
index 0000000..6b74a41
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path_select/Makefile
@@ -0,0 +1,40 @@
+#
+# 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$
+#
+
+all: shell
+ @${MAKE} sh_test
+ @${MAKE} csh_test
+ @if [ -x /bin/ksh ] ; then ${MAKE} ksh_test ; fi
+
+shell: sh.sh
+ @cp ${.CURDIR}/sh.sh ${.OBJDIR}/shell
+ @chmod +x ${.OBJDIR}/shell
+
+.ifmake sh_test
+
+.SHELL: name=sh path=${.OBJDIR}/shell
+sh_test:
+ @: This is the shell.
+
+.elifmake csh_test
+
+.SHELL: name=csh path=${.OBJDIR}/shell
+csh_test:
+ @: This is the C-shell.
+
+.elifmake ksh_test
+
+.SHELL: name=ksh path=${.OBJDIR}/shell
+ksh_test:
+ @: This is the Korn-shell.
+
+.endif
diff --git a/tools/regression/usr.bin/make/shell/path_select/expected.status b/tools/regression/usr.bin/make/shell/path_select/expected.status
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path_select/expected.status
@@ -0,0 +1 @@
+2
diff --git a/tools/regression/usr.bin/make/shell/path_select/expected.stderr b/tools/regression/usr.bin/make/shell/path_select/expected.stderr
new file mode 100644
index 0000000..628ea8f
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path_select/expected.stderr
@@ -0,0 +1 @@
+make: don't know how to make sh.sh. Stop
diff --git a/tools/regression/usr.bin/make/shell/path_select/expected.stdout b/tools/regression/usr.bin/make/shell/path_select/expected.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path_select/expected.stdout
diff --git a/tools/regression/usr.bin/make/shell/path_select/sh.sh b/tools/regression/usr.bin/make/shell/path_select/sh.sh
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path_select/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/path_select/test.t b/tools/regression/usr.bin/make/shell/path_select/test.t
new file mode 100644
index 0000000..fef0eb9
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/path_select/test.t
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+cd `dirname $0`
+. ../../common.sh
+
+desc_test()
+{
+ echo "New path for builtin shells (2)."
+}
+
+eval_cmd $1
diff --git a/tools/regression/usr.bin/make/shell/select/Makefile b/tools/regression/usr.bin/make/shell/select/Makefile
new file mode 100644
index 0000000..127dca2
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/select/Makefile
@@ -0,0 +1,33 @@
+#
+# 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$
+#
+
+all:
+ @${MAKE} sh
+ @${MAKE} csh
+ @if [ -x /bin/ksh ] ; then ${MAKE} ksh ; fi
+
+.ifmake sh
+
+.SHELL: name=sh
+sh: print_path
+
+.elifmake csh
+
+.SHELL: name=csh
+csh: print_path
+
+.elifmake ksh
+
+.SHELL: name=ksh
+ksh: print_path
+
+.endif
+
+print_path:
+ @ps -opid,command | awk '$$1=='$$$$' { print $$2; }'
diff --git a/tools/regression/usr.bin/make/shell/select/expected.status b/tools/regression/usr.bin/make/shell/select/expected.status
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/select/expected.status
@@ -0,0 +1 @@
+0
diff --git a/tools/regression/usr.bin/make/shell/select/expected.stderr b/tools/regression/usr.bin/make/shell/select/expected.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/select/expected.stderr
diff --git a/tools/regression/usr.bin/make/shell/select/expected.stdout b/tools/regression/usr.bin/make/shell/select/expected.stdout
new file mode 100644
index 0000000..4e4093b
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/select/expected.stdout
@@ -0,0 +1,2 @@
+/bin/sh
+/bin/csh
diff --git a/tools/regression/usr.bin/make/shell/select/test.t b/tools/regression/usr.bin/make/shell/select/test.t
new file mode 100644
index 0000000..0a129c0
--- /dev/null
+++ b/tools/regression/usr.bin/make/shell/select/test.t
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+cd `dirname $0`
+. ../../common.sh
+
+desc_test()
+{
+ echo "Select the builtin sh shell."
+}
+
+eval_cmd $1
OpenPOWER on IntegriCloud