Bugzilla – Attachment 182311 Details for
Bug 39877
CI - Incremental runs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39877: Apply to other slow tests
Bug-39877-Apply-to-other-slow-tests.patch (text/plain), 5.15 KB, created by
Jonathan Druart
on 2025-05-12 20:36:05 UTC
(
hide
)
Description:
Bug 39877: Apply to other slow tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-05-12 20:36:05 UTC
Size:
5.15 KB
patch
obsolete
>From e5cc6df2862b6443eecd6095791cb87106af2ae7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 12 May 2025 16:10:10 +0200 >Subject: [PATCH] Bug 39877: Apply to other slow tests > >--- > Koha/Devel/CI/IncrementalRuns.pm | 4 ++-- > Koha/Devel/Files.pm | 38 ++++++++++++++++++++++++++++++++ > xt/author/codespell.t | 16 +++++++++----- > xt/perltidy.t | 14 +++++++----- > 4 files changed, 59 insertions(+), 13 deletions(-) > >diff --git a/Koha/Devel/CI/IncrementalRuns.pm b/Koha/Devel/CI/IncrementalRuns.pm >index b14077ea88f..ec183b8632b 100644 >--- a/Koha/Devel/CI/IncrementalRuns.pm >+++ b/Koha/Devel/CI/IncrementalRuns.pm >@@ -129,7 +129,7 @@ sub get_files_to_test { > @koha_commit_history; > if ($last_build_commit) { > @files = @{ from_json( read_file("$self->{git_repo_dir}/$self->{test_name}/$last_build_commit") ) }; >- push @files, $dev_files->ls_perl_files("$last_build_commit HEAD"); >+ push @files, $dev_files->ls_files( $filetype, "$last_build_commit HEAD" ); > } else { > > # In case we run on a branch that does not have ancestor commits in the history >@@ -140,7 +140,7 @@ sub get_files_to_test { > $no_history = 1; > } > } >- @files = $dev_files->ls_perl_files if !$self->{incremental_run} || $no_history; >+ @files = $dev_files->ls_files($filetype) if !$self->{incremental_run} || $no_history; > > return @files; > } >diff --git a/Koha/Devel/Files.pm b/Koha/Devel/Files.pm >index 6f8c572185c..1d7f0085db4 100644 >--- a/Koha/Devel/Files.pm >+++ b/Koha/Devel/Files.pm >@@ -118,6 +118,44 @@ sub build_git_exclude { > : q{}; > } > >+=head2 ls_files >+ >+ my @files = $file_manager->ls_files($filetype, $git_range); >+ >+Lists files that have been modified within a specified Git range. If no range is provided, it lists all Perl files, excluding those specified in the exceptions. >+ >+=cut >+ >+sub ls_files { >+ my ( $self, $filetype, $git_range ) = @_; >+ my @files; >+ if ($git_range) { >+ $git_range =~ s|\.\.| |; >+ my @modified_files = qx{git diff --name-only $git_range}; >+ chomp @modified_files; >+ if ( $filetype eq 'pl' ) { >+ push @files, grep { -e && /\.(pl|PL|pm|t)$/ } @modified_files; >+ push @files, grep { -e && /^(svc|opac\/svc)/ } @modified_files; >+ } elsif ( $filetype eq 'js' ) { >+ push @files, grep { -e && /\.(js|ts|vue)$/ } @modified_files; >+ } elsif ( $filetype eq 'tt' ) { >+ push @files, grep { -e && /\.(tt|inc)$/ } @modified_files; >+ } >+ >+ my @exception_files = $exceptions->{$filetype}->{ $self->{context} }; >+ @files = array_minus( @files, @exception_files ); >+ } else { >+ if ( $filetype eq 'pl' ) { >+ @files = $self->ls_perl_files; >+ } elsif ( $filetype eq 'js' ) { >+ @files = $self->ls_js_files; >+ } elsif ( $filetype eq 'tt' ) { >+ @files = $self->ls_tt_files; >+ } >+ } >+ return @files; >+} >+ > =head2 ls_perl_files > > my @perl_files = $file_manager->ls_perl_files($git_range); >diff --git a/xt/author/codespell.t b/xt/author/codespell.t >index e31799ca517..25f65c13be4 100755 >--- a/xt/author/codespell.t >+++ b/xt/author/codespell.t >@@ -3,7 +3,7 @@ use Modern::Perl; > use Test::PerlTidy; > use Test::More; > >-use Koha::Devel::Files; >+use Koha::Devel::CI::IncrementalRuns; > > my $codespell_version = qx{codespell --version}; > chomp $codespell_version; >@@ -11,16 +11,20 @@ $codespell_version =~ s/-.*$//; > if ( ( $codespell_version =~ s/\.//gr ) < 220 ) { # if codespell < 2.2.0 > plan skip_all => "codespell version $codespell_version too low, need at least 2.2.0"; > } >-my $dev_files = Koha::Devel::Files->new( { context => 'codespell' } ); >+ >+my $ci = Koha::Devel::CI::IncrementalRuns->new( { context => 'codespell' } ); > my @files; >-push @files, $dev_files->ls_perl_files; >-push @files, $dev_files->ls_tt_files; >-push @files, $dev_files->ls_js_files; >+push @files, $ci->get_files_to_test('pl'); >+push @files, $ci->get_files_to_test('tt'); >+push @files, $ci->get_files_to_test('js'); > > plan tests => scalar @files; > >+my %results; > for my $file (@files) { > my $output = qx{codespell -d --ignore-words .codespell-ignore $file}; > chomp $output; >- is( $output, q{} ); >+ is( $output, q{} ) or $results{$file} = 1; > } >+ >+$ci->report_results( \%results ); >diff --git a/xt/perltidy.t b/xt/perltidy.t >index 5fb424d2071..6c1148a9b16 100755 >--- a/xt/perltidy.t >+++ b/xt/perltidy.t >@@ -2,14 +2,18 @@ > use Modern::Perl; > use Test::PerlTidy; > use Test::More; >+use Test::NoWarnings; > >-use Koha::Devel::Files; >+use Koha::Devel::CI::IncrementalRuns; > >-my $dev_files = Koha::Devel::Files->new; >-my @files = $dev_files->ls_perl_files( { context => 'tidy' } ); >+my $ci = Koha::Devel::CI::IncrementalRuns->new( { context => 'tidy' } ); >+my @files = $ci->get_files_to_test('pl'); > >-plan tests => scalar @files; >+plan tests => scalar @files + 1; > >+my %results; > for my $file (@files) { >- ok( Test::PerlTidy::is_file_tidy($file) ); >+ ok( Test::PerlTidy::is_file_tidy($file) ) or $results{$file} = 1; > } >+ >+$ci->report_results( \%results ); >-- >2.34.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 39877
:
182308
|
182309
|
182310
|
182311
|
182347
|
182348
|
182349
|
182350
|
182355
|
182356
|
182357
|
182358