Bug 23934: Unit test
[koha.git] / t / db_dependent / 00-strict.t
blobc91c6017f933b9ffdfca489d7e8adfe5f2956ba8
1 #!/usr/bin/perl
2 # This script is called by the pre-commit git hook to test modules compile
4 use strict;
5 use warnings;
7 use threads; # used for parallel
8 use Test::More;
9 use Test::Strict;
10 use Parallel::ForkManager;
11 use Sys::CPU;
13 use lib("misc/translator");
14 use lib("installer");
16 my @dirs = (
17 'acqui', 'admin',
18 'authorities', 'basket',
19 'catalogue', 'cataloguing',
20 'changelanguage.pl', 'circ',
21 'debian', 'docs',
22 'errors', 'fix-perl-path.PL', 'help.pl',
23 'installer', 'koha_perl_deps.pl',
24 'kohaversion.pl', 'labels',
25 'mainpage.pl', 'Makefile.PL',
26 'members', 'misc',
27 'offline_circ', 'opac',
28 'patroncards', 'reports',
29 'reserve', 'reviews',
30 'rewrite-config.PL', 'rotating_collections',
31 'serials', 'services',
32 'skel', 'suggestion',
33 'svc', 'tags',
34 'tools', 'virtualshelves'
37 $Test::Strict::TEST_STRICT = 0;
38 $Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl' ];
40 my $ncpu;
41 if ( $ENV{KOHA_PROVE_CPUS} ) {
42 $ncpu = $ENV{KOHA_PROVE_CPUS} ; # set number of cpus to use
43 } else {
44 $ncpu = Sys::CPU::cpu_count();
47 print "Using $ncpu CPUs...\n"
48 if $ENV{DEBUG};
50 my $pm = new Parallel::ForkManager($ncpu);
52 foreach my $d (@dirs) {
53 $pm->start and next; # do the fork
55 all_perl_files_ok($d);
57 $pm->finish; # do the exit in the child process
60 $pm->wait_all_children;
62 done_testing();