diff options
Diffstat (limited to 'unit-tests')
-rw-r--r-- | unit-tests/Makefile.in | 7 | ||||
-rw-r--r-- | unit-tests/export-env | 24 | ||||
-rw-r--r-- | unit-tests/test.exp | 8 |
3 files changed, 37 insertions, 2 deletions
diff --git a/unit-tests/Makefile.in b/unit-tests/Makefile.in index a64a07434383..bfd29b261397 100644 --- a/unit-tests/Makefile.in +++ b/unit-tests/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.40 2012/12/28 21:28:19 sjg Exp $ +# $Id: Makefile.in,v 1.42 2013/03/23 02:31:13 sjg Exp $ # -# $NetBSD: Makefile,v 1.35 2012/11/09 19:08:28 sjg Exp $ +# $NetBSD: Makefile,v 1.36 2013/03/22 16:36:46 sjg Exp $ # # Unit tests for make(1) # The main targets are: @@ -28,6 +28,7 @@ SUBFILES= \ error \ export \ export-all \ + export-env \ doterror \ dotwait \ forloop \ @@ -72,10 +73,12 @@ TOOL_TR?= tr TOOL_DIFF?= diff DIFF_FLAGS?= @diff_u@ +.if defined(.PARSEDIR) # ensure consistent results from sort(1) LC_ALL= C LANG= C .export LANG LC_ALL +.endif # The driver. # We always pretend .MAKE was called 'make' diff --git a/unit-tests/export-env b/unit-tests/export-env new file mode 100644 index 000000000000..b6ce6a251cc6 --- /dev/null +++ b/unit-tests/export-env @@ -0,0 +1,24 @@ +# $Id: export-env,v 1.1.1.1 2013/03/23 02:26:59 sjg Exp $ + +# our normal .export, subsequent changes affect the environment +UT_TEST=this +.export UT_TEST +UT_TEST:= ${.PARSEFILE} + +# not so with .export-env +UT_ENV=exported +.export-env UT_ENV +UT_ENV=not-exported + +# gmake style export goes further; affects nothing but the environment +UT_EXP=before-export +export UT_EXP=exported +UT_EXP=not-exported + +all: + @echo make:; ${UT_TEST UT_ENV UT_EXP:L:@v@echo $v=${$v};@} + @echo env:; ${UT_TEST UT_ENV UT_EXP:L:@v@echo $v=$${$v};@} + + + + diff --git a/unit-tests/test.exp b/unit-tests/test.exp index 368dc3156dbb..b6fad78d21bc 100644 --- a/unit-tests/test.exp +++ b/unit-tests/test.exp @@ -43,6 +43,14 @@ UT_OK=good UT_OKDIR=unit-tests UT_TEST=export-all UT_ZOO=hoopie +make: +UT_TEST=export-env +UT_ENV=not-exported +UT_EXP=not-exported +env: +UT_TEST=export-env +UT_ENV=exported +UT_EXP=exported At first, I am happy and now: sad |