Commit | Line | Data |
844f2408 |
1 | use Config; |
2 | BEGIN { |
3 | unless ($Config{useithreads}) { |
4 | print "1..0 # SKIP your perl does not support ithreads\n"; |
5 | exit 0; |
6 | } |
7 | } |
8 | |
9 | BEGIN { |
10 | unless (eval { require threads }) { |
11 | print "1..0 # SKIP threads.pm not installed\n"; |
12 | exit 0; |
13 | } |
14 | } |
15 | |
16 | use threads; |
5197ed54 |
17 | use threads::shared; |
18 | |
19 | our $had_error :shared; |
20 | END { $? = $had_error||0 } |
21 | |
844f2408 |
22 | use strict; |
5197ed54 |
23 | use warnings; |
844f2408 |
24 | |
9aaf3646 |
25 | BEGIN { |
53daa838 |
26 | if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) { |
27 | require DynaLoader; |
28 | no warnings 'redefine'; |
29 | my $orig = \&DynaLoader::bootstrap; |
30 | *DynaLoader::bootstrap = sub { |
31 | die 'no XS' if $_[0] eq 'Devel::GlobalDestruction'; |
32 | goto $orig; |
33 | }; |
34 | } |
9aaf3646 |
35 | } |
36 | |
5197ed54 |
37 | # load it before spawning a thread, that's the whole point |
38 | require Devel::GlobalDestruction; |
39 | |
40 | sub do_test { |
41 | |
42 | # just die so we don't need to deal with testcount skew |
43 | unless ( ($_[0]||'') eq 'arg' ) { |
44 | $had_error++; |
45 | die "Argument passing failed!"; |
46 | } |
47 | |
48 | delete $INC{'t/01_basic.t'}; |
49 | do 't/01_basic.t'; |
50 | |
51 | 1; |
52 | } |
844f2408 |
53 | |
5197ed54 |
54 | threads->create('do_test', 'arg')->join |
55 | or $had_error++; |