1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Add some regression tests for the .SHELL target. I'm not sure that the

output of shell_2j is actually correct - it just tests what make currently
does. Make should switch on echoing for the second line, shouldn't it?
This commit is contained in:
Hartmut Brandt 2004-11-25 10:03:29 +00:00
parent 21d15001f9
commit 7b54cdda4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138080
7 changed files with 124 additions and 2 deletions

View File

@ -19,7 +19,7 @@ DATA1:= ${DATA5:S/l/r/g}
NIL=
all:
@echo '1..14'
@echo '1..16'
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
@echo "ok 1 - test_variables # Test variables detected no regression, output matches."
@ -49,6 +49,10 @@ all:
@echo "ok 13 plus_flag # Test plus_flag detected no regression."
@! ${MAKE} shell >/dev/null 2>&1 && true || ${MAKE} failure
@echo "ok 14 shell # Test shell detected no regression."
@${MAKE} shell_1 || ${MAKE} failure
@echo "ok 15 shell_1 # Test shell_1 detected no regression."
@${MAKE} shell_2 || ${MAKE} failure
@echo "ok 16 shell_2 # Test shell_2 detected no regression."
.if make(double)
# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
@ -233,6 +237,51 @@ A!= echo ok
shell:
.endif
.if make(shell_1)
# Test if setting the shell by name only works. Because we have no ksh
# in the base system we test that we can set sh and csh. We try only exact
# matching names and do not exercise the rather strange matching algorithm.
shell_1:
@${MAKE} shell_1_csh
@${MAKE} shell_1_sh
.endif
.if make(shell_1_csh)
.SHELL: name="csh"
shell_1_csh:
@echo $${shell} | grep -q '^/bin/csh$$'
.endif
.if make(shell_1_sh)
.SHELL: name="sh"
shell_1_sh:
@ps -ax -opid,command | awk '$$1=="'$$$$'" { print $$2 }' | grep -q '^/bin/sh$$'
.endif
.if make(shell_2)
# Test if we can replace the shell specification. We do this by using
# a shell scripts that prints us its arguments and standard input as the shell
shell_2:
@${MAKE} -B shell_2B | \
diff -u ${.CURDIR}/regress.shell_2B.out - || false
@${MAKE} -j1 shell_2j | \
diff -u ${.CURDIR}/regress.shell_2j.out - || false
.endif
.if make(shell_2B)
.SHELL: name="echo" path="${.CURDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors"
shell_2B:
-@funny $$
funnier $$
.endif
.if make(shell_2j)
.SHELL: name="echo" path="${.CURDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors"
shell_2j:
-@funny $$
funnier $$
.endif
failure:
@echo "not ok # Test failed: regression detected. See above."
@false

View File

@ -0,0 +1,3 @@
-c funny $
funnier $
-ec funnier $

View File

@ -0,0 +1,6 @@
-yx
be quiet
ignore errors
funny $
check errors
funnier $

View File

@ -19,7 +19,7 @@ DATA1:= ${DATA5:S/l/r/g}
NIL=
all:
@echo '1..14'
@echo '1..16'
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
@echo "ok 1 - test_variables # Test variables detected no regression, output matches."
@ -49,6 +49,10 @@ all:
@echo "ok 13 plus_flag # Test plus_flag detected no regression."
@! ${MAKE} shell >/dev/null 2>&1 && true || ${MAKE} failure
@echo "ok 14 shell # Test shell detected no regression."
@${MAKE} shell_1 || ${MAKE} failure
@echo "ok 15 shell_1 # Test shell_1 detected no regression."
@${MAKE} shell_2 || ${MAKE} failure
@echo "ok 16 shell_2 # Test shell_2 detected no regression."
.if make(double)
# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
@ -233,6 +237,51 @@ A!= echo ok
shell:
.endif
.if make(shell_1)
# Test if setting the shell by name only works. Because we have no ksh
# in the base system we test that we can set sh and csh. We try only exact
# matching names and do not exercise the rather strange matching algorithm.
shell_1:
@${MAKE} shell_1_csh
@${MAKE} shell_1_sh
.endif
.if make(shell_1_csh)
.SHELL: name="csh"
shell_1_csh:
@echo $${shell} | grep -q '^/bin/csh$$'
.endif
.if make(shell_1_sh)
.SHELL: name="sh"
shell_1_sh:
@ps -ax -opid,command | awk '$$1=="'$$$$'" { print $$2 }' | grep -q '^/bin/sh$$'
.endif
.if make(shell_2)
# Test if we can replace the shell specification. We do this by using
# a shell scripts that prints us its arguments and standard input as the shell
shell_2:
@${MAKE} -B shell_2B | \
diff -u ${.CURDIR}/regress.shell_2B.out - || false
@${MAKE} -j1 shell_2j | \
diff -u ${.CURDIR}/regress.shell_2j.out - || false
.endif
.if make(shell_2B)
.SHELL: name="echo" path="${.CURDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors"
shell_2B:
-@funny $$
funnier $$
.endif
.if make(shell_2j)
.SHELL: name="echo" path="${.CURDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors"
shell_2j:
-@funny $$
funnier $$
.endif
failure:
@echo "not ok # Test failed: regression detected. See above."
@false

View File

@ -0,0 +1,3 @@
-c funny $
funnier $
-ec funnier $

View File

@ -0,0 +1,6 @@
-yx
be quiet
ignore errors
funny $
check errors
funnier $

View File

@ -0,0 +1,6 @@
#!/bin/sh
# $FreeBSD$
echo $@
if ! test -t 0 ; then
cat
fi