From ae3b54bb466c405a1e735c47d5d103e82410b3a0 Mon Sep 17 00:00:00 2001 From: Philip Orr Date: Wed, 26 Jul 2023 08:18:53 +0000 Subject: [PATCH] Bug 29324: Change test to look at all .pm or .pl files This patch changes the test at xt/find-license-problems.t to look at all .pm or .pl files. Other files will only be checked if they contain the message "This file is part of Koha". To test: 1. Apply the patch 2. Run find-license-problems.t from the root of your Koha src directory: $ perl xt/find-license-problems.t 3. You should be getting 1476 fails --- xt/find-license-problems.t | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xt/find-license-problems.t b/xt/find-license-problems.t index 1417677b89..0e1323c5ef 100755 --- a/xt/find-license-problems.t +++ b/xt/find-license-problems.t @@ -55,15 +55,16 @@ foreach my $name (@files) { $haslinktolicense = 1 if $line =~ m|http://www\.gnu\.org/licenses|; $hasfranklinst = 1 if ( $line =~ /51 Franklin Street/ ); $is_not_us = 1 if $line =~ m|This file is part of the Zebra server|; - $needs_copyright = 1 if $line =~ m|This file is part of Koha|; + $needs_copyright = 1 if $line =~ m|This file is part of Koha| || $name =~ /(.*).pl/ || $name =~ /(.*).pm/; } close $fh; next unless $hascopyright || $needs_copyright; next if $is_not_us; - is( $hasgpl + is( $hascopyright + && $hasgpl && $hasv3 && $hasorlater && $haslinktolicense - && !$hasfranklinst, 1 ) or diag(sprintf "File %s has wrong copyright: hasgpl=%s, hasv3=%s, hasorlater=%s, haslinktolicense=%s, hasfranklinst=%s", $name, $hasgpl, $hasv3, $hasorlater, $haslinktolicense, $hasfranklinst); + && !$hasfranklinst, 1 ) or diag(sprintf "File %s has wrong copyright: hascopyright=%s, hasgpl=%s, hasv3=%s, hasorlater=%s, haslinktolicense=%s, hasfranklinst=%s", $name, $hascopyright, $hasgpl, $hasv3, $hasorlater, $haslinktolicense, $hasfranklinst); } done_testing; -- 2.30.2