Some test cases for .SHELL target: builtin shell selection and
changing the path of a builtin shell.
This commit is contained in:
parent
b4b4c81522
commit
56f5aba2ca
48
tools/regression/usr.bin/make/shell/path/Makefile
Normal file
48
tools/regression/usr.bin/make/shell/path/Makefile
Normal file
@ -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
|
1
tools/regression/usr.bin/make/shell/path/expected.status
Normal file
1
tools/regression/usr.bin/make/shell/path/expected.status
Normal file
@ -0,0 +1 @@
|
||||
2
|
1
tools/regression/usr.bin/make/shell/path/expected.stderr
Normal file
1
tools/regression/usr.bin/make/shell/path/expected.stderr
Normal file
@ -0,0 +1 @@
|
||||
make: don't know how to make sh.sh. Stop
|
6
tools/regression/usr.bin/make/shell/path/sh.sh
Normal file
6
tools/regression/usr.bin/make/shell/path/sh.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
echo $@
|
||||
if ! test -t 0 ; then
|
||||
cat
|
||||
fi
|
13
tools/regression/usr.bin/make/shell/path/test.t
Normal file
13
tools/regression/usr.bin/make/shell/path/test.t
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
. ../../common.sh
|
||||
|
||||
desc_test()
|
||||
{
|
||||
echo "New path for builtin shells."
|
||||
}
|
||||
|
||||
eval_cmd $1
|
40
tools/regression/usr.bin/make/shell/path_select/Makefile
Normal file
40
tools/regression/usr.bin/make/shell/path_select/Makefile
Normal file
@ -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
|
@ -0,0 +1 @@
|
||||
2
|
@ -0,0 +1 @@
|
||||
make: don't know how to make sh.sh. Stop
|
6
tools/regression/usr.bin/make/shell/path_select/sh.sh
Normal file
6
tools/regression/usr.bin/make/shell/path_select/sh.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
echo $@
|
||||
if ! test -t 0 ; then
|
||||
cat
|
||||
fi
|
13
tools/regression/usr.bin/make/shell/path_select/test.t
Normal file
13
tools/regression/usr.bin/make/shell/path_select/test.t
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
. ../../common.sh
|
||||
|
||||
desc_test()
|
||||
{
|
||||
echo "New path for builtin shells (2)."
|
||||
}
|
||||
|
||||
eval_cmd $1
|
33
tools/regression/usr.bin/make/shell/select/Makefile
Normal file
33
tools/regression/usr.bin/make/shell/select/Makefile
Normal file
@ -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; }'
|
@ -0,0 +1 @@
|
||||
0
|
@ -0,0 +1,2 @@
|
||||
/bin/sh
|
||||
/bin/csh
|
13
tools/regression/usr.bin/make/shell/select/test.t
Normal file
13
tools/regression/usr.bin/make/shell/select/test.t
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
. ../../common.sh
|
||||
|
||||
desc_test()
|
||||
{
|
||||
echo "Select the builtin sh shell."
|
||||
}
|
||||
|
||||
eval_cmd $1
|
Loading…
Reference in New Issue
Block a user