Bugzilla – Attachment 184172 Details for
Bug 40402
xt/find-license-problems.t is failing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40402: Make xt/find-license-problems.t process files that are in the git index
Bug-40402-Make-xtfind-license-problemst-process-fi.patch (text/plain), 3.60 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-07-16 20:11:51 UTC
(
hide
)
Description:
Bug 40402: Make xt/find-license-problems.t process files that are in the git index
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-07-16 20:11:51 UTC
Size:
3.60 KB
patch
obsolete
>From fff3b93fba9f6ef7ebe033403a9eb46b687aca99 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Jul 2025 10:31:18 +0200 >Subject: [PATCH] Bug 40402: Make xt/find-license-problems.t process files that > are in the git index > >And only those files. > >Currently the test is failing with >02:52:31 koha_1 | # Failed test at xt/find-license-problems.t line 65. >02:52:31 koha_1 | # got: '0' >02:52:31 koha_1 | # expected: '1' >02:52:33 koha_1 | # File ./misc/translator/po/LICENSE has wrong copyright: hasgpl=1, hasv3=1, hasorlater=1, haslinktolicense=0, hasfranklinst=0 >02:52:33 koha_1 | # Looks like you failed 1 test of 1381. >02:52:33 koha_1 | [00:51:24] xt/find-license-problems.t > >Because a LICENSE file has been added to koha-l10n, and now this test fails on it. > >https://gitlab.com/koha-community/koha-l10n/-/commit/27ab9ff4d2462c3f95cd54ae4a2e53ce7d2f6a65 > >But we should not test files that are not part of the git index. > >Test plan: >0. Do not apply this patch >1. Edit xt/find-license-problems.t, add > warn scalar(@files); >2. Run `prove xt/find-license-problems.t` >=> Notice that 4056 files are processed >Note that you need to have a clean git repo. You can run the following >git command BUT BEWARE /*\ it will remove all changes not committed > `git clean -d -f` >3. Apply this patch, prove again >=> Tests are passing, with the same number of tests >xt/find-license-problems.t .. ok >All tests successful. >Files=1, Tests=4056 > >Note that I think we lost one file, as Test::NoWarnings is adding a >test. But I don't think it is worth the trouble to find out which one is >missing. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > xt/find-license-problems.t | 35 ++++++++++++++++++----------------- > 1 file changed, 18 insertions(+), 17 deletions(-) > >diff --git a/xt/find-license-problems.t b/xt/find-license-problems.t >index 5f93516aa54..92edba9353e 100755 >--- a/xt/find-license-problems.t >+++ b/xt/find-license-problems.t >@@ -25,22 +25,20 @@ > > use Modern::Perl; > use Test::More; >+use Test::NoWarnings; > >-use File::Spec; >-use File::Find; >+my @files = map { >+ chomp; >+ my $name = $_; >+ !( $name =~ m{^koha-tmpl/} >+ || $name =~ m{\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip)$} >+ || $name =~ m{xt/find-license-problems|xt/fix-old-fsf-address|misc/translator/po2json} >+ || !-f $name ) >+ ? $_ >+ : () >+} `git ls-tree -r HEAD --name-only`; # only files part of git > >-my @files; >- >-sub wanted { >- my $name = $File::Find::name; >- push @files, $name >- unless $name =~ /\/(\.git|koha-tmpl|node_modules|swagger-ui)(\/.*)?$/ >- || $name =~ /\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip|patch)$/ >- || $name =~ m[(xt/find-license-problems|xt/fix-old-fsf-address|misc/translator/po2json)] >- || !-f $name; >-} >- >-find( { wanted => \&wanted, no_chdir => 1 }, File::Spec->curdir() ); >+plan tests => scalar(@files) + 1; > > foreach my $name (@files) { > open( my $fh, '<', $name ) || die "cannot open file $name $!"; >@@ -60,8 +58,12 @@ foreach my $name (@files) { > $is_not_us = 1 if $line =~ m|This file is part of the Zebra server|; > } > close $fh; >- next unless $hascopyright; >- next if $is_not_us; >+ >+ if ( !$hascopyright || $is_not_us ) { >+ pass(); >+ next; >+ } >+ > is( $hasgpl && $hasv3 && $hasorlater && $haslinktolicense && !$hasfranklinst, 1 ) > or diag( > sprintf >@@ -69,4 +71,3 @@ foreach my $name (@files) { > $name, $hasgpl, $hasv3, $hasorlater, $haslinktolicense, $hasfranklinst > ); > } >-done_testing; >-- >2.50.1
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 40402
:
184124
|
184172
|
184173
|
184174