diff options
Diffstat (limited to 'tests/scripts/features/export')
-rw-r--r-- | tests/scripts/features/export | 158 |
1 files changed, 49 insertions, 109 deletions
diff --git a/tests/scripts/features/export b/tests/scripts/features/export index 38efe11..81bff0c 100644 --- a/tests/scripts/features/export +++ b/tests/scripts/features/export @@ -6,12 +6,7 @@ $details = ""; # The test driver cleans out our environment for us so we don't have to worry # about that here. -open(MAKEFILE,"> $makefile"); - -# The Contents of the MAKEFILE ... - -print MAKEFILE <<'EOMAKE'; - +&run_make_test(' FOO = foo BAR = bar BOZ = boz @@ -40,76 +35,44 @@ endif all: @echo "FOO=$(FOO) BAR=$(BAR) BAZ=$(BAZ) BOZ=$(BOZ) BITZ=$(BITZ) BOTZ=$(BOTZ)" @echo "FOO=$$FOO BAR=$$BAR BAZ=$$BAZ BOZ=$$BOZ BITZ=$$BITZ BOTZ=$$BOTZ" - -EOMAKE - -close(MAKEFILE); - -# TEST 0: basics - -&run_make_with_options($makefile,"",&get_logfile,0); - -$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz -FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; - -&compare_output($answer,&get_logfile(1)); +', + '', "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz +FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); # TEST 1: make sure vars inherited from the parent are exported $extraENV{FOO} = 1; -&run_make_with_options($makefile,"",&get_logfile,0); - -$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz -FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; - -&compare_output($answer,&get_logfile(1)); +&run_make_test(undef, '', "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz +FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); # TEST 2: global export. Explicit unexport takes precedence. -&run_make_with_options($makefile,"EXPORT_ALL=1",&get_logfile,0); - -$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz -FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; - -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "EXPORT_ALL=1" , + "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz +FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); # TEST 3: global unexport. Explicit export takes precedence. -&run_make_with_options($makefile,"UNEXPORT_ALL=1",&get_logfile,0); - -$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz -FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; - -&compare_output($answer,&get_logfile(1)); +&run_make_test(undef, "UNEXPORT_ALL=1", + "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz +FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); # TEST 4: both: in the above makefile the unexport comes last so that rules. -&run_make_with_options($makefile,"EXPORT_ALL=1 UNEXPORT_ALL=1",&get_logfile,0); - -$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz -FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; - -&compare_output($answer,&get_logfile(1)); +&run_make_test(undef, "EXPORT_ALL=1 UNEXPORT_ALL=1", + "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz +FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); # TEST 5: test the pseudo target. -&run_make_with_options($makefile,"EXPORT_ALL_PSEUDO=1",&get_logfile,0); - -$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz -FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; - -&compare_output($answer,&get_logfile(1)); - +&run_make_test(undef, "EXPORT_ALL_PSEUDO=1", + "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz +FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); # TEST 6: Test the expansion of variables inside export -$makefile2 = &get_tmpfile; - -open(MAKEFILE, "> $makefile2"); - -print MAKEFILE <<'EOF'; - +&run_make_test(' foo = f-ok bar = b-ok @@ -125,24 +88,12 @@ export $(B)ar all: @echo foo=$(foo) bar=$(bar) @echo foo=$$foo bar=$$bar - -EOF - -close(MAKEFILE); - -&run_make_with_options($makefile2,"",&get_logfile,0); -$answer = "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n"; -&compare_output($answer,&get_logfile(1)); - +', + "", "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n"); # TEST 7: Test the expansion of variables inside unexport -$makefile3 = &get_tmpfile; - -open(MAKEFILE, "> $makefile3"); - -print MAKEFILE <<'EOF'; - +&run_make_test(' foo = f-ok bar = b-ok @@ -160,24 +111,12 @@ unexport $(B)ar all: @echo foo=$(foo) bar=$(bar) @echo foo=$$foo bar=$$bar - -EOF - -close(MAKEFILE); - -&run_make_with_options($makefile3,"",&get_logfile,0); -$answer = "foo=f-ok bar=b-ok\nfoo= bar=\n"; -&compare_output($answer,&get_logfile(1)); - +', + '', "foo=f-ok bar=b-ok\nfoo= bar=\n"); # TEST 7: Test exporting multiple variables on the same line -$makefile4 = &get_tmpfile; - -open(MAKEFILE, "> $makefile4"); - -print MAKEFILE <<'EOF'; - +&run_make_test(' A = a B = b C = c @@ -196,23 +135,14 @@ export F G H I J export D E $(SOME) all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J -EOF - -close(MAKEFILE); - -&run_make_with_options($makefile4,"",&get_logfile,0); -$answer = "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"; -&compare_output($answer,&get_logfile(1)); - +', + '', "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"); # TEST 8: Test unexporting multiple variables on the same line -$makefile5 = &get_tmpfile; - -open(MAKEFILE, "> $makefile5"); - -print MAKEFILE <<'EOF'; +@extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); +&run_make_test(' A = a B = b C = c @@ -231,16 +161,26 @@ unexport F G H I J unexport D E $(SOME) all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J -EOF - -close(MAKEFILE); - -@extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); - -&run_make_with_options($makefile5,"",&get_logfile,0); -$answer = "A= B= C= D= E= F= G= H= I= J=\n"; -&compare_output($answer,&get_logfile(1)); - +', + '', "A= B= C= D= E= F= G= H= I= J=\n"); + +# TEST 9: Check setting a variable named "export" + +&run_make_test(' +export = 123 +export export +export export = 456 +a: ; @echo "\$$(export)=$(export) / \$$export=$$export" +', + '', "\$(export)=456 / \$export=456\n"); + +# TEST 9: Check "export" as a target + +&run_make_test(' +a: export +export: ; @echo "$@" +', + '', "export\n"); # This tells the test driver that the perl test script executed properly. 1; |