diff options
author | sjg <sjg@FreeBSD.org> | 2015-05-10 22:03:59 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-05-10 22:03:59 +0000 |
commit | bc53a56c01080bcfa62c2433c36de981d18eb977 (patch) | |
tree | 55e17b1e670746d9e5a85e6f1585f57a143fe34e /contrib/bmake/unit-tests | |
parent | 2c4686751c3442d00e8ca8a4684be7de7901df5a (diff) | |
parent | 168edd726ad8a54339e142aec8bee10c893b7326 (diff) | |
download | FreeBSD-src-bc53a56c01080bcfa62c2433c36de981d18eb977.zip FreeBSD-src-bc53a56c01080bcfa62c2433c36de981d18eb977.tar.gz |
Merge bmake-20150505 improve detection of malformed conditionals.
Diffstat (limited to 'contrib/bmake/unit-tests')
-rw-r--r-- | contrib/bmake/unit-tests/Makefile.in | 5 | ||||
-rw-r--r-- | contrib/bmake/unit-tests/cond2.exp | 7 | ||||
-rw-r--r-- | contrib/bmake/unit-tests/cond2.mk | 25 |
3 files changed, 35 insertions, 2 deletions
diff --git a/contrib/bmake/unit-tests/Makefile.in b/contrib/bmake/unit-tests/Makefile.in index f5f528c..6974d48 100644 --- a/contrib/bmake/unit-tests/Makefile.in +++ b/contrib/bmake/unit-tests/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.46 2014/11/06 01:47:57 sjg Exp $ +# $Id: Makefile.in,v 1.47 2015/05/05 21:58:06 sjg Exp $ # -# $NetBSD: Makefile,v 1.51 2014/10/20 23:21:11 sjg Exp $ +# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $ # # Unit tests for make(1) # The main targets are: @@ -27,6 +27,7 @@ UNIT_TESTS:= ${srcdir} TESTNAMES= \ comment \ cond1 \ + cond2 \ error \ export \ export-all \ diff --git a/contrib/bmake/unit-tests/cond2.exp b/contrib/bmake/unit-tests/cond2.exp new file mode 100644 index 0000000..22e76a5 --- /dev/null +++ b/contrib/bmake/unit-tests/cond2.exp @@ -0,0 +1,7 @@ +make: Bad conditional expression ` == "empty"' in == "empty"?oops:ok +make: "cond2.mk" line 13: Malformed conditional ({TEST_TYPO} == "Ok") +TEST_NOT_SET is empty or not defined +make: "cond2.mk" line 20: Malformed conditional (${TEST_NOT_SET} == "empty") +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 diff --git a/contrib/bmake/unit-tests/cond2.mk b/contrib/bmake/unit-tests/cond2.mk new file mode 100644 index 0000000..d6a0620 --- /dev/null +++ b/contrib/bmake/unit-tests/cond2.mk @@ -0,0 +1,25 @@ +# $Id: cond2.mk,v 1.1.1.1 2015/05/05 21:53:13 sjg Exp $ + +TEST_UNAME_S= NetBSD + +# this should be ok +X:= ${${TEST_UNAME_S} == "NetBSD":?Ok:fail} +.if $X == "Ok" +Y= good +.endif +# expect: Bad conditional expression ` == "empty"' in == "empty"?oops:ok +X:= ${${TEST_NOT_SET} == "empty":?oops:ok} +# expect: Malformed conditional ({TEST_TYPO} == "Ok") +.if {TEST_TYPO} == "Ok" +Y= oops +.endif +.if empty(TEST_NOT_SET) +Y!= echo TEST_NOT_SET is empty or not defined >&2; echo +.endif +# expect: Malformed conditional (${TEST_NOT_SET} == "empty") +.if ${TEST_NOT_SET} == "empty" +Y= oops +.endif + +all: + @echo $@ |