This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
De-dup the output of git ls-files
[perl5.git] / t / perf / taint.t
CommitLineData
ed382232
TC
1#!./perl -T
2#
3# All the tests in this file are ones that run exceptionally slowly
4# (each test taking seconds or even minutes) in the absence of particular
5# optimisations. Thus it is a sort of canary for optimisations being
6# broken.
7#
8# Although it includes a watchdog timeout, this is set to a generous limit
9# to allow for running on slow systems; therefore a broken optimisation
10# might be indicated merely by this test file taking unusually long to
11# run, rather than actually timing out.
12#
13# This is similar to t/perf/speed.t but tests performance regressions specific
14# to taint.
15#
16
17BEGIN {
18 chdir 't' if -d 't';
19 @INC = ('../lib');
20 require Config; import Config;
21 require './test.pl';
ce6c6959 22 skip_all_if_miniperl("No Scalar::Util under miniperl");
ed382232
TC
23}
24
25use strict;
26use warnings;
27use Scalar::Util qw(tainted);
28
29$| = 1;
30
31plan tests => 2;
32
33watchdog(60);
34
35{
36 my $in = substr($ENV{PATH}, 0, 0) . ( "ab" x 200_000 );
37 utf8::upgrade($in);
38 ok(tainted($in), "performance issue only when tainted");
39 while ($in =~ /\Ga+b/g) { }
40 pass("\\G on tainted string");
41}
42
431;