summaryrefslogtreecommitdiff
path: root/lib/B
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-31 13:22:15 +0200
committerYves Orton <demerphq@gmail.com>2023-04-02 21:29:27 +0800
commit66fb7f3ccb1926b56f594504da99cc8d5f1ec579 (patch)
treeb26d99b496afb21de56e71d5b422beb211f8b5d5 /lib/B
parentd565ab093ebca8e24573aebc9ca0dd5b47cca754 (diff)
downloadperl-66fb7f3ccb1926b56f594504da99cc8d5f1ec579.tar.gz
test infra - Under -DNO_TAINT_SUPPORT skip tests that use -T or -t
This patch uses a collection of heuristics to skip test files which would die on a perl compiled with -DNO_TAINT_SUPPORT but without -DSILENT_NO_TAINT_SUPPORT. -DNO_TAINT_SUPPORT disables taint support in a "safe" way, such that if you try to use taint mode with the -t or -T options an exception will be thrown informing you that the perl you are using does not support taint. (The related setting -DSILENT_NO_TAINT_SUPPORT disables taint support but causes the -t and -T options to be silently ignored.) The error from using -t and -T is thrown very early in the process startup and there is no way to "gracefully" handle it and convert it into something else, for instance to skip a test file which contains it. This patch generally fixes our code to skip these tests. * Make t/TEST and t/harness check shebang lines and use filename checks to filter out tests that use -t or -T. Primarily this is the result of checking their shebang line, but some cpan/ files are excluded by name, either from a very short list of exclusions, or because their file name contains the word "taint". Non-cpan test files were fixed individually as noted below. * test.pl - make run_multiple_progs() skip test cases based on the switches that are part of the test definition. This function is used in a great deal of our internal tests, so it fixes a lot of tests in one go. * XS-APITest/t/call.t, t/run/switchDX.t, lib/B/Deparse.t - Skip a small set of tests in each file.
Diffstat (limited to 'lib/B')
-rw-r--r--lib/B/Deparse.t29
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index 8cd3fb4d27..eb6bcc3828 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -307,14 +307,19 @@ x(); z()
.
EOCODH
-is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path, '-T' ],
+SKIP: {
+ skip("Your perl was built without taint support", 1)
+ unless $Config::Config{taint_support};
+
+ is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path, '-T' ],
prog => "format =\n\@\n\$;\n.\n"),
- <<'EOCODM', '$; on format line';
-format STDOUT =
-@
-$;
-.
-EOCODM
+ <<~'EOCODM', '$; on format line';
+ format STDOUT =
+ @
+ $;
+ .
+ EOCODM
+}
is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse,-l', $path ],
prog => "format =\n\@\n\$foo\n.\n"),
@@ -537,10 +542,14 @@ is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path ],
"sub BEGIN {\n \$main::{'f'} = \\!0;\n}\n",
'&PL_sv_yes constant (used to croak)';
-is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path, '-T' ],
+SKIP: {
+ skip("Your perl was built without taint support", 1)
+ unless $Config::Config{taint_support};
+ is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path, '-T' ],
prog => '$x =~ (1?/$a/:0)'),
- '$x =~ ($_ =~ /$a/);'."\n",
- '$foo =~ <branch-folded match> under taint mode';
+ '$x =~ ($_ =~ /$a/);'."\n",
+ '$foo =~ <branch-folded match> under taint mode';
+}
unlike runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path, '-w' ],
prog => 'BEGIN { undef &foo }'),