This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #24940] "sub foo :unique" segfaults
[perl5.git] / ext / threads / t / stress_re.t
CommitLineData
31623e47
JH
1BEGIN {
2 chdir 't' if -d 't';
974ec8aa 3 push @INC, '../lib';
31623e47
JH
4 require Config; import Config;
5 unless ($Config{'useithreads'}) {
6 print "1..0 # Skip: no useithreads\n";
7 exit 0;
8 }
9}
10
11use ExtUtils::testlib;
12use strict;
13BEGIN { print "1..64\n" };
14use threads;
15
16
17print "ok 1\n";
18
19
20
21
22sub ok {
23 my ($id, $ok, $name) = @_;
24
25 # You have to do it this way or VMS will get confused.
26 print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
27
28 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
29
30 return $ok;
31}
32
33
34ok(2,1,"");
35
36sub test9 {
0f85ce8a 37 my $s = "abcd" x (1000 + $_[0]);
31623e47
JH
38 my $t = '';
39 while ($s =~ /(.)/g) { $t .= $1 }
40 print "not ok $_[0]\n" if $s ne $t;
41}
42my @threads;
43for(3..33) {
44 ok($_,1,"Multiple thread test");
45 push @threads ,threads->create('test9',$_);
46}
47
48my $i = 34;
49for(@threads) {
50 $_->join;
51 ok($i++,1,"Thread joined");
52}
53