Bugzilla – Attachment 180240 Details for
Bug 39365
`perl -cw` should pass on all Perl files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39365: Add tests
Bug-39365-Add-tests.patch (text/plain), 3.31 KB, created by
Martin Renvoize (ashimema)
on 2025-04-02 07:36:56 UTC
(
hide
)
Description:
Bug 39365: Add tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-04-02 07:36:56 UTC
Size:
3.31 KB
patch
obsolete
>From b8ee395ba98a95332e8db86c98879efd7a26e768 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 18 Mar 2025 12:13:03 +0100 >Subject: [PATCH] Bug 39365: Add tests > >We exclude (for now) some files that needs additional work: >1. Koha/Account/Credit.pm, Koha/Account/Debit.pm and Koha/Old/Hold.pm > "Inconsistent hierarchy during C3 merge of class" >2. misc/translator/TmplTokenizer.pm > Can't locate VerboseWarnings.pm in @INC > >We also ignore some known warnings. > >Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > xt/pl_valid.t | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > create mode 100755 xt/pl_valid.t > >diff --git a/xt/pl_valid.t b/xt/pl_valid.t >new file mode 100755 >index 00000000000..028710deb20 >--- /dev/null >+++ b/xt/pl_valid.t >@@ -0,0 +1,83 @@ >+#!/usr/bin/env perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use threads; # used for parallel >+use Test::More; >+use Test::NoWarnings; >+use Pod::Checker; >+ >+use Parallel::ForkManager; >+use Sys::CPU; >+ >+my @files; >+push @files, qx{git ls-files '*.pl' '*.PL' '*.pm' '*.t'}; >+push @files, qx{git ls-files svc opac/svc}; # Files without extension >+chomp for @files; >+ >+my @exceptions = qw( >+ Koha/Account/Credit.pm >+ Koha/Account/Debit.pm >+ Koha/Old/Hold.pm >+ misc/translator/TmplTokenizer.pm >+); >+ >+my $ncpu; >+if ( $ENV{KOHA_PROVE_CPUS} ) { >+ $ncpu = $ENV{KOHA_PROVE_CPUS}; >+} else { >+ $ncpu = Sys::CPU::cpu_count(); >+} >+ >+my $pm = Parallel::ForkManager->new($ncpu); >+ >+plan tests => scalar(@files) + 1; >+ >+for my $file (@files) { >+ if ( grep { $file eq $_ } @exceptions ) { >+ pass("$file is skipped - exception"); >+ next; >+ } >+ $pm->start and next; >+ my $output = `perl -cw '$file' 2>&1`; >+ chomp $output; >+ if ($?) { >+ fail("$file has syntax errors"); >+ diag($output); >+ } elsif ( $output =~ /^$file syntax OK$/ ) { >+ pass("$file passed syntax check"); >+ } else { >+ my @fails; >+ for my $line ( split "\n", $output ) { >+ next if $line =~ m{^$file syntax OK$}; >+ next if $line =~ m{^Subroutine .* redefined at}; >+ next if $line =~ m{^Constant subroutine .* redefined at}; >+ >+ next if $line =~ m{Name "Lingua::Ispell::path" used only once: possible typo at C4/Tags.pm}; >+ push @fails, $line; >+ } >+ if (@fails) { >+ fail("$file has syntax warnings."); >+ diag( join "\n", @fails ); >+ } else { >+ pass("$file passed syntax check"); >+ } >+ } >+ $pm->finish; >+} >+ >+$pm->wait_all_children; >-- >2.49.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39365
:
179445
|
179446
|
179740
|
179741
| 180240 |
180241