fix thread test relying on . in @INC
[p5sagit/Devel-GlobalDestruction-XS.git] / t / 02_thread.t
CommitLineData
101e5667 1use Config;
2BEGIN {
3 unless ($Config{useithreads}) {
4 print "1..0 # SKIP your perl does not support ithreads\n";
5 exit 0;
6 }
7}
8
9BEGIN {
10 unless (eval { require threads }) {
11 print "1..0 # SKIP threads.pm not installed\n";
12 exit 0;
13 }
14}
15
16use threads;
17use threads::shared;
18
19our $had_error :shared;
20END { $? = $had_error||0 }
21
22use strict;
23use warnings;
24
25# load it before spawning a thread, that's the whole point
26require Devel::GlobalDestruction::XS;
27
28sub do_test {
29
30 # just die so we don't need to deal with testcount skew
31 unless ( ($_[0]||'') eq 'arg' ) {
32 $had_error++;
33 die "Argument passing failed!";
34 }
35
ef104b18 36 delete $INC{'./t/01_basic.t'};
37 do './t/01_basic.t';
101e5667 38
39 1;
40}
41
42threads->create('do_test', 'arg')->join
43 or $had_error++;