From b2f252c7bc199c1eab693e75006fd228849a5672 Mon Sep 17 00:00:00 2001 From: harti Date: Thu, 19 May 2005 11:23:01 +0000 Subject: Some test cases for .SHELL target: builtin shell selection and changing the path of a builtin shell. --- tools/regression/usr.bin/make/shell/path/Makefile | 48 ++++++++++++++++++++++ .../usr.bin/make/shell/path/expected.status | 1 + .../usr.bin/make/shell/path/expected.stderr | 1 + .../usr.bin/make/shell/path/expected.stdout | 0 tools/regression/usr.bin/make/shell/path/sh.sh | 6 +++ tools/regression/usr.bin/make/shell/path/test.t | 13 ++++++ .../usr.bin/make/shell/path_select/Makefile | 40 ++++++++++++++++++ .../usr.bin/make/shell/path_select/expected.status | 1 + .../usr.bin/make/shell/path_select/expected.stderr | 1 + .../usr.bin/make/shell/path_select/expected.stdout | 0 .../usr.bin/make/shell/path_select/sh.sh | 6 +++ .../usr.bin/make/shell/path_select/test.t | 13 ++++++ .../regression/usr.bin/make/shell/select/Makefile | 33 +++++++++++++++ .../usr.bin/make/shell/select/expected.status | 1 + .../usr.bin/make/shell/select/expected.stderr | 0 .../usr.bin/make/shell/select/expected.stdout | 2 + tools/regression/usr.bin/make/shell/select/test.t | 13 ++++++ 17 files changed, 179 insertions(+) create mode 100644 tools/regression/usr.bin/make/shell/path/Makefile create mode 100644 tools/regression/usr.bin/make/shell/path/expected.status create mode 100644 tools/regression/usr.bin/make/shell/path/expected.stderr create mode 100644 tools/regression/usr.bin/make/shell/path/expected.stdout create mode 100644 tools/regression/usr.bin/make/shell/path/sh.sh create mode 100644 tools/regression/usr.bin/make/shell/path/test.t create mode 100644 tools/regression/usr.bin/make/shell/path_select/Makefile create mode 100644 tools/regression/usr.bin/make/shell/path_select/expected.status create mode 100644 tools/regression/usr.bin/make/shell/path_select/expected.stderr create mode 100644 tools/regression/usr.bin/make/shell/path_select/expected.stdout create mode 100644 tools/regression/usr.bin/make/shell/path_select/sh.sh create mode 100644 tools/regression/usr.bin/make/shell/path_select/test.t create mode 100644 tools/regression/usr.bin/make/shell/select/Makefile create mode 100644 tools/regression/usr.bin/make/shell/select/expected.status create mode 100644 tools/regression/usr.bin/make/shell/select/expected.stderr create mode 100644 tools/regression/usr.bin/make/shell/select/expected.stdout create mode 100644 tools/regression/usr.bin/make/shell/select/test.t (limited to 'tools/regression/usr.bin') 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 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 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 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 -- cgit v1.1