diff options
-rw-r--r-- | t/comp/opsubs.t | 15 | ||||
-rw-r--r-- | t/lib/warnings/taint | 31 | ||||
-rw-r--r-- | t/op/taint.t | 9 | ||||
-rw-r--r-- | t/perf/taint.t | 3 | ||||
-rw-r--r-- | t/run/runenv.t | 13 | ||||
-rw-r--r-- | t/run/switcht.t | 6 |
6 files changed, 60 insertions, 17 deletions
diff --git a/t/comp/opsubs.t b/t/comp/opsubs.t index 89b1af517f..3636dcbb51 100644 --- a/t/comp/opsubs.t +++ b/t/comp/opsubs.t @@ -1,4 +1,4 @@ -#!./perl -Tw +#!./perl -w # Uncomment this for testing, but don't leave it in for "production", as # we've not yet verified that use works. @@ -147,12 +147,13 @@ is( &qw('amper'), "qw-amper", "&qw() is func" ); # qx operator can_ok( 'main', "qx" ); -eval "qx('unqualified'". - ($^O eq 'MSWin32' ? " 2>&1)" : ")"); -TODO: { - local $::TODO = $^O eq 'MSWin32' ? "Tainting of PATH not working of Windows" : $::TODO; - like( $@, qr/^Insecure/, "qx('unqualified') doesn't work" ); -} +eval q{ + BEGIN { + *CORE::GLOBAL::readpipe = sub { die "readpipe called" }; + } + qx('unqualified'); +}; +like( $@, qr/^readpipe called/, "qx('unqualified') is oper" ); is( main::qx('main'), "qx-main", "main::qx() is func" ); is( &qx('amper'), "qx-amper", "&qx() is func" ); diff --git a/t/lib/warnings/taint b/t/lib/warnings/taint index b0ec91c938..12bcc25975 100644 --- a/t/lib/warnings/taint +++ b/t/lib/warnings/taint @@ -8,19 +8,33 @@ __END__ def --FILE-- # taint.c +use Config; +BEGIN { + if ( exists($Config{taint_support}) && not $Config{taint_support}) { + print "SKIPPED\n# your perl was built without taint support\n"; + exit 0; + } +} open(FH, "<abc") ; $a = <FH> ; close FH ; chdir $a ; print "xxx\n" ; EXPECT -Insecure dependency in chdir while running with -T switch at - line 5. +Insecure dependency in chdir while running with -T switch at - line 12. ######## -TU --FILE-- abc def --FILE-- # taint.c +use Config; +BEGIN { + if ( exists($Config{taint_support}) && not $Config{taint_support}) { + print "SKIPPED\n# your perl was built without taint support\n"; + exit 0; + } +} open(FH, "<abc") ; $a = <FH> ; close FH ; @@ -32,8 +46,8 @@ use warnings 'taint' ; chdir $a ; print "yyy\n" ; EXPECT -Insecure dependency in chdir while running with -T switch at - line 5. -Insecure dependency in chdir while running with -T switch at - line 10. +Insecure dependency in chdir while running with -T switch at - line 12. +Insecure dependency in chdir while running with -T switch at - line 17. xxx yyy ######## @@ -42,6 +56,13 @@ yyy def --FILE-- # taint.c +use Config; +BEGIN { + if ( exists($Config{taint_support}) && not $Config{taint_support}) { + print "SKIPPED\n# your perl was built without taint support\n"; + exit 0; + } +} open(FH, "<abc") ; $a = <FH> ; close FH ; @@ -53,7 +74,7 @@ use warnings 'taint' ; chdir $a ; print "yyy\n" ; EXPECT -Insecure dependency in chdir while running with -t switch at - line 5. -Insecure dependency in chdir while running with -t switch at - line 10. +Insecure dependency in chdir while running with -t switch at - line 12. +Insecure dependency in chdir while running with -t switch at - line 17. xxx yyy diff --git a/t/op/taint.t b/t/op/taint.t index c1ca6d345c..f4f06f7461 100644 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -18,6 +18,13 @@ use strict; use warnings; use Config; +my $NoTaintSupport = exists($Config{taint_support}) && !$Config{taint_support}; + +if ($NoTaintSupport) { + skip_all("your perl was built without taint support"); + exit 0; +} + plan tests => 1054; $| = 1; @@ -124,7 +131,7 @@ sub violates_taint { # We need an external program to call. my $ECHO = ($Is_MSWin32 ? ".\\tmpecho$$" : "./tmpecho$$"); -END { unlink $ECHO } +END { unlink $ECHO unless $NoTaintSupport } open my $fh, '>', $ECHO or die "Can't create $ECHO: $!"; print $fh 'print "@ARGV\n"', "\n"; close $fh; diff --git a/t/perf/taint.t b/t/perf/taint.t index 797f0ad905..22a35608e2 100644 --- a/t/perf/taint.t +++ b/t/perf/taint.t @@ -20,6 +20,9 @@ BEGIN { require Config; import Config; require './test.pl'; skip_all_if_miniperl("No Scalar::Util under miniperl"); + if (exists($Config{taint_support}) && !$Config{taint_support}) { + skip_all("built without taint support"); + } } use strict; diff --git a/t/run/runenv.t b/t/run/runenv.t index a406fd3174..b32b4f20a9 100644 --- a/t/run/runenv.t +++ b/t/run/runenv.t @@ -123,10 +123,15 @@ try({PERL5OPT => '-w -w'}, '-w -w', ''); -try({PERL5OPT => '-t'}, - ['-e', 'print ${^TAINT}'], - '-1', - ''); +SKIP: { + if (exists($Config{taint_support}) && !$Config{taint_support}) { + skip("built without taint support", 2); + } + try({PERL5OPT => '-t'}, + ['-e', 'print ${^TAINT}'], + '-1', + ''); +} try({PERL5OPT => '-W'}, ['-I../lib','-e', 'local $^W = 0; no warnings; print $x'], diff --git a/t/run/switcht.t b/t/run/switcht.t index 01b9f2f623..533d8be992 100644 --- a/t/run/switcht.t +++ b/t/run/switcht.t @@ -6,6 +6,12 @@ BEGIN { require './test.pl'; } +use Config; + +if (exists($Config{taint_support}) && !$Config{taint_support}) { + skip_all("perl built without taint support"); +} + plan tests => 13; my $Perl = which_perl(); |