Revision 3ee997c2
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
t/structure/common_errors.t | ||
---|---|---|
1 | 1 |
#!/usr/bin/perl |
2 | 2 |
|
3 | 3 |
use strict; |
4 |
use threads; |
|
4 | 5 |
use lib 't'; |
5 | 6 |
use Support::Files; |
7 |
use Sys::CPU; |
|
8 |
use Thread::Pool::Simple; |
|
6 | 9 |
|
7 | 10 |
my ($testcount); |
8 | 11 |
|
... | ... | |
38 | 41 |
[ '\$slef' ], |
39 | 42 |
); |
40 | 43 |
|
41 |
foreach my $file (@testitems) { |
|
44 |
sub test_file { |
|
45 |
my ($file) = @_; |
|
42 | 46 |
$file =~ s/\s.*$//; # nuke everything after the first space (#comment) |
43 |
next if (!$file); # skip null entries
|
|
47 |
return if (!$file); # skip null entries
|
|
44 | 48 |
|
45 | 49 |
if (open (FILE, $file)) { # open the file for reading |
46 | 50 |
$_->[1] = [] foreach @common_errors; |
... | ... | |
67 | 71 |
} |
68 | 72 |
} |
69 | 73 |
|
70 |
exit 0; |
|
74 |
my $pool = Thread::Pool::Simple->new( |
|
75 |
min => 2, |
|
76 |
max => Sys::CPU::cpu_count() + 1, |
|
77 |
do => [ \&test_file ], |
|
78 |
passid => 0, |
|
79 |
); |
|
80 |
|
|
81 |
$pool->add($_) for @testitems; |
|
71 | 82 |
|
83 |
$pool->join; |
|
84 |
|
|
85 |
exit 0; |
Auch abrufbar als: Unified diff
Tests: t/structure/common_errors.t parallelisiert