|
Line 0
Link Here
|
| 0 |
- |
1 |
#/usr/bin/perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 18 |
use Modern::Perl; |
| 19 |
use threads; # used for parallel |
| 20 |
use File::Slurp qw( read_file ); |
| 21 |
use Test::More; |
| 22 |
use Test::Strict; |
| 23 |
use Parallel::ForkManager; |
| 24 |
use Sys::CPU; |
| 25 |
|
| 26 |
my @tt_files = |
| 27 |
qx{git ls-files '*.tt' '*.inc' ':(exclude)Koha/ILL/Backend/' ':(exclude)*doc-head-open.inc' ':(exclude)misc/cronjobs/rss'}; |
| 28 |
|
| 29 |
$Test::Strict::TEST_STRICT = 0; |
| 30 |
|
| 31 |
my $ncpu; |
| 32 |
if ( $ENV{KOHA_PROVE_CPUS} ) { |
| 33 |
$ncpu = $ENV{KOHA_PROVE_CPUS}; |
| 34 |
} else { |
| 35 |
$ncpu = Sys::CPU::cpu_count(); |
| 36 |
} |
| 37 |
|
| 38 |
my $pm = Parallel::ForkManager->new($ncpu); |
| 39 |
|
| 40 |
foreach my $filepath (@tt_files) { |
| 41 |
$pm->start and next; |
| 42 |
|
| 43 |
chomp $filepath; |
| 44 |
my $tidy = qx{perl misc/devel/tidy.pl --silent --no-write $filepath}; |
| 45 |
my $content = read_file $filepath; |
| 46 |
ok( $content eq $tidy, "$filepath should be kept tidy" ); |
| 47 |
|
| 48 |
$pm->finish; |
| 49 |
} |
| 50 |
|
| 51 |
$pm->wait_all_children; |
| 52 |
|
| 53 |
done_testing; |