Commit | Line | Data |
---|---|---|
e3faa678 NC |
1 | #!perl |
2 | use strict; | |
3 | use warnings; | |
4 | ||
dd249ef4 NC |
5 | # As perlfunc.pod says: |
6 | # Note that the file will not be included twice under the same specified name. | |
7 | # So ensure that this, textually, is the same name as all the loaded tests use. | |
8 | # Otherwise if we require 'test.pl' and they require './test.pl', it is loaded | |
9 | # twice. | |
10 | require './test.pl'; | |
11 | skip_all_without_config('useithreads'); | |
12 | skip_all_if_miniperl("no dynamic loading on miniperl, no threads"); | |
e3faa678 NC |
13 | |
14 | require threads; | |
15 | ||
4f018ed0 NC |
16 | # Which file called us? |
17 | my $caller = (caller)[1]; | |
18 | ||
19 | die "Can't figure out which test to run from filename '$caller'" | |
20 | unless $caller =~ m!((?:op|re)/[-_a-z0-9A-Z]+)_thr\.t\z!; | |
21 | ||
22 | my $file = "$1.t"; | |
23 | ||
24 | $::running_as_thread = "running tests in a new thread"; | |
25 | require $file; | |
26 | ||
27 | note('running tests in a new thread'); | |
28 | ||
66478a1b NC |
29 | # Currently 59*4096 is the minimum stack size to just get t/re/pat_thr.t to |
30 | # pass on HP-UX 64bit PA-RISC. The test for capture buffers (eg \87) | |
31 | # recurses heavily, and busts the default stack size (65536 on PA-RISC) | |
c534a167 | 32 | # On Mac OS X under gcc and g++, the default stack size is also too small. |
20c29910 | 33 | # Ditto on VMS, although threshold varies by platform and -Dusevmsdebug. |
66478a1b | 34 | my $curr = threads->create({ |
c534a167 | 35 | stack_size => $^O eq 'hpux' ? 524288 : |
20c29910 CB |
36 | $^O eq 'darwin' ? 1000000: |
37 | $^O eq 'VMS' ? 150000 : 0, | |
66478a1b | 38 | }, sub { |
4f018ed0 NC |
39 | run_tests(); |
40 | return defined &curr_test ? curr_test() : () | |
41 | })->join(); | |
42 | ||
43 | curr_test($curr) if defined $curr; | |
e3faa678 NC |
44 | |
45 | 1; |