Commit | Line | Data |
1035e7c4 |
1 | package t::threads_check; |
2 | |
3 | sub _skip { |
4 | print "1..0 # SKIP $_[0]\n"; |
5 | exit 0; |
6 | } |
7 | |
8 | sub import { |
9 | my ($class, $op) = @_; |
10 | if ($0 eq '-' && $op) { |
11 | if ($op eq 'installed') { |
12 | eval { require threads } or exit 1; |
13 | } |
14 | elsif ($op eq 'create') { |
15 | require threads; |
16 | threads->create(sub{ 1 })->join; |
17 | } |
18 | exit 0; |
19 | } |
20 | require Config; |
21 | if (! $Config::Config{useithreads}) { |
22 | _skip "your perl does not support ithreads"; |
23 | } |
24 | elsif (system "$^X", '-Mt::threads_check=installed') { |
25 | _skip "threads.pm not installed"; |
26 | } |
27 | elsif (system "$^X", '-Mt::threads_check=create') { |
04659fea |
28 | print STDERR <<'END' |
29 | ############################################################################# |
30 | # Threads appear broken on this machine. |
31 | # Subsequent test will likely FAIL, due to your environment. |
32 | ############################################################################# |
33 | END |
1035e7c4 |
34 | } |
35 | } |
36 | |
37 | 1; |