X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2Fdb_dependent%2F00-strict.t;h=c91c6017f933b9ffdfca489d7e8adfe5f2956ba8;hb=63f40e519c7fbbba70a2944113830a1d3ed80306;hp=7869591fe5e2c2d347803599ebd4b7dc55351653;hpb=b2b16fb8cf4bf89862eba6fc14d507dc79de4db7;p=koha.git diff --git a/t/db_dependent/00-strict.t b/t/db_dependent/00-strict.t old mode 100644 new mode 100755 index 7869591fe5..c91c6017f9 --- a/t/db_dependent/00-strict.t +++ b/t/db_dependent/00-strict.t @@ -1,24 +1,62 @@ +#!/usr/bin/perl # This script is called by the pre-commit git hook to test modules compile use strict; use warnings; + +use threads; # used for parallel use Test::More; use Test::Strict; -use File::Spec; -use File::Find; +use Parallel::ForkManager; +use Sys::CPU; + use lib("misc/translator"); use lib("installer"); -my @dirs = ( 'acqui', 'admin', 'authorities', 'basket', - 'catalogue', 'cataloguing', 'changelanguage.pl', 'circ', 'debian', 'docs', - 'edithelp.pl', 'errors', 'fix-perl-path.PL', 'help.pl', 'installer', - 'koha_perl_deps.pl', 'kohaversion.pl', 'labels', - 'mainpage.pl', 'Makefile.PL', 'members', 'misc', 'offline_circ', 'opac', - 'patroncards', 'reports', 'reserve', 'resetversion.pl', 'reviews', - 'rewrite-config.PL', 'rotating_collections', 'serials', 'services', 'skel', - 'sms', 'suggestion', 'svc', 'tags', 'tools', 'virtualshelves' ); +my @dirs = ( + 'acqui', 'admin', + 'authorities', 'basket', + 'catalogue', 'cataloguing', + 'changelanguage.pl', 'circ', + 'debian', 'docs', + 'errors', 'fix-perl-path.PL', 'help.pl', + 'installer', 'koha_perl_deps.pl', + 'kohaversion.pl', 'labels', + 'mainpage.pl', 'Makefile.PL', + 'members', 'misc', + 'offline_circ', 'opac', + 'patroncards', 'reports', + 'reserve', 'reviews', + 'rewrite-config.PL', 'rotating_collections', + 'serials', 'services', + 'skel', 'suggestion', + 'svc', 'tags', + 'tools', 'virtualshelves' +); $Test::Strict::TEST_STRICT = 0; -$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl', 'sms/sms_listen_windows_start.pl' ]; +$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl' ]; + +my $ncpu; +if ( $ENV{KOHA_PROVE_CPUS} ) { + $ncpu = $ENV{KOHA_PROVE_CPUS} ; # set number of cpus to use +} else { + $ncpu = Sys::CPU::cpu_count(); +} + +print "Using $ncpu CPUs...\n" + if $ENV{DEBUG}; + +my $pm = new Parallel::ForkManager($ncpu); + +foreach my $d (@dirs) { + $pm->start and next; # do the fork + + all_perl_files_ok($d); + + $pm->finish; # do the exit in the child process +} + +$pm->wait_all_children; -all_perl_files_ok(@dirs); +done_testing();