summaryrefslogtreecommitdiffstats
path: root/tools/build
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-11-25 10:03:29 +0000
committerharti <harti@FreeBSD.org>2004-11-25 10:03:29 +0000
commitf4e37f6f60d1d3f8f8e334738707004bbfc62c41 (patch)
treeb2245e57cb9ae5f8650cfe80ffb31bc01bf04c27 /tools/build
parent0083a3a1f9faf52a2685157969f9810ee3675a84 (diff)
downloadFreeBSD-src-f4e37f6f60d1d3f8f8e334738707004bbfc62c41.zip
FreeBSD-src-f4e37f6f60d1d3f8f8e334738707004bbfc62c41.tar.gz
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?
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/make_check/Makefile51
-rw-r--r--tools/build/make_check/regress.shell_2B.out3
-rw-r--r--tools/build/make_check/regress.shell_2j.out6
3 files changed, 59 insertions, 1 deletions
diff --git a/tools/build/make_check/Makefile b/tools/build/make_check/Makefile
index 7715d23..ec35ea7 100644
--- a/tools/build/make_check/Makefile
+++ b/tools/build/make_check/Makefile
@@ -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
diff --git a/tools/build/make_check/regress.shell_2B.out b/tools/build/make_check/regress.shell_2B.out
new file mode 100644
index 0000000..eff99ea
--- /dev/null
+++ b/tools/build/make_check/regress.shell_2B.out
@@ -0,0 +1,3 @@
+-c funny $
+funnier $
+-ec funnier $
diff --git a/tools/build/make_check/regress.shell_2j.out b/tools/build/make_check/regress.shell_2j.out
new file mode 100644
index 0000000..c79a09a
--- /dev/null
+++ b/tools/build/make_check/regress.shell_2j.out
@@ -0,0 +1,6 @@
+-yx
+be quiet
+ignore errors
+funny $
+check errors
+funnier $
OpenPOWER on IntegriCloud