|
Lines 1-24
Link Here
|
|
|
1 |
#!/usr/bin/perl |
| 1 |
# This script is called by the pre-commit git hook to test modules compile |
2 |
# This script is called by the pre-commit git hook to test modules compile |
| 2 |
|
3 |
|
| 3 |
use strict; |
4 |
use strict; |
| 4 |
use warnings; |
5 |
use warnings; |
|
|
6 |
|
| 7 |
use threads; # used for parallel |
| 5 |
use Test::More; |
8 |
use Test::More; |
| 6 |
use Test::Strict; |
9 |
use Test::Strict; |
| 7 |
use File::Spec; |
10 |
use Parallel::ForkManager; |
| 8 |
use File::Find; |
11 |
use Sys::CPU; |
|
|
12 |
|
| 9 |
use lib("misc/translator"); |
13 |
use lib("misc/translator"); |
| 10 |
use lib("installer"); |
14 |
use lib("installer"); |
| 11 |
|
15 |
|
| 12 |
my @dirs = ( 'acqui', 'admin', 'authorities', 'basket', |
16 |
my @dirs = ( |
| 13 |
'catalogue', 'cataloguing', 'changelanguage.pl', 'circ', 'debian', 'docs', |
17 |
'acqui', 'admin', |
| 14 |
'edithelp.pl', 'errors', 'fix-perl-path.PL', 'help.pl', 'installer', |
18 |
'authorities', 'basket', |
| 15 |
'koha_perl_deps.pl', 'kohaversion.pl', 'labels', |
19 |
'catalogue', 'cataloguing', |
| 16 |
'mainpage.pl', 'Makefile.PL', 'members', 'misc', 'offline_circ', 'opac', |
20 |
'changelanguage.pl', 'circ', |
| 17 |
'patroncards', 'reports', 'reserve', 'resetversion.pl', 'reviews', |
21 |
'debian', 'docs', |
| 18 |
'rewrite-config.PL', 'rotating_collections', 'serials', 'services', 'skel', |
22 |
'edithelp.pl', 'errors', |
| 19 |
'sms', 'suggestion', 'svc', 'tags', 'tools', 'virtualshelves' ); |
23 |
'fix-perl-path.PL', 'help.pl', |
|
|
24 |
'installer', 'koha_perl_deps.pl', |
| 25 |
'kohaversion.pl', 'labels', |
| 26 |
'mainpage.pl', 'Makefile.PL', |
| 27 |
'members', 'misc', |
| 28 |
'offline_circ', 'opac', |
| 29 |
'patroncards', 'reports', |
| 30 |
'reserve', 'resetversion.pl', |
| 31 |
'reviews', 'rewrite-config.PL', |
| 32 |
'rotating_collections', 'serials', |
| 33 |
'services', 'skel', |
| 34 |
'sms', 'suggestion', |
| 35 |
'svc', 'tags', |
| 36 |
'tools', 'virtualshelves' |
| 37 |
); |
| 20 |
|
38 |
|
| 21 |
$Test::Strict::TEST_STRICT = 0; |
39 |
$Test::Strict::TEST_STRICT = 0; |
| 22 |
$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl', 'sms/sms_listen_windows_start.pl', 'misc/plack/koha.psgi' ]; |
40 |
$Test::Strict::TEST_SKIP = [ |
|
|
41 |
'misc/kohalib.pl', 'sms/sms_listen_windows_start.pl', |
| 42 |
'misc/plack/koha.psgi' |
| 43 |
]; |
| 44 |
|
| 45 |
my $ncpu; |
| 46 |
if ( $ENV{KOHA_JENKINS} ) { |
| 47 |
$ncpu = 2; # works fastest on kc.org jenkins box |
| 48 |
} else { |
| 49 |
$ncpu = Sys::CPU::cpu_count(); |
| 50 |
} |
| 51 |
|
| 52 |
my $pm = new Parallel::ForkManager($ncpu); |
| 53 |
|
| 54 |
foreach my $d (@dirs) { |
| 55 |
$pm->start and next; # do the fork |
| 56 |
|
| 57 |
all_perl_files_ok($d); |
| 58 |
|
| 59 |
$pm->finish; # do the exit in the child process |
| 60 |
} |
| 61 |
|
| 62 |
$pm->wait_all_children; |
| 23 |
|
63 |
|
| 24 |
all_perl_files_ok(@dirs); |
64 |
done_testing(); |
| 25 |
- |
|
|