Module: tools Branch: master Commit: 13631f0cc172671b60755cb2a6c25226fac69824 URL: https://gitlab.winehq.org/winehq/tools/-/commit/13631f0cc172671b60755cb2a6c2...
Author: Francois Gouget fgouget@codeweavers.com Date: Thu Jun 22 02:05:50 2023 +0200
testbot: Include the step and task number in the reference file logs.
While the test report name is unique per job when running the full suite (i.e. 1 win32.log, 1 wow32.log, etc), our reference files now include the task.log files and those are not, neither for full test suite jobs, nor for Wine update ones. So to avoid having collisions in the task.log reference file names, use the full jobid.stepno.taskno in their names.
---
testbot/bin/Janitor.pl | 2 +- testbot/bin/UpdateTaskLogs | 6 +++--- testbot/lib/WineTestBot/LogUtils.pm | 4 ++-- testbot/lib/WineTestBot/Tasks.pm | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl index 169bc3cb..4e4b26f8 100755 --- a/testbot/bin/Janitor.pl +++ b/testbot/bin/Janitor.pl @@ -347,7 +347,7 @@ if (opendir(my $dh, "$DataDir/latest")) my $TTL = $JobPurgeDays ? $JobPurgeDays - $Age : undef;
# Keep the regexp in sync with WineTestBot::Task::GetRefReportName() - if ($Entry !~ /^[a-zA-Z0-9_]+-job[0-9]+-[a-zA-Z0-9_]+.(?:log|report)(?:.errors)?$/) + if ($Entry !~ /^[a-zA-Z0-9_]+-job[0-9.]+-[a-zA-Z0-9_]+.(?:log|report)(?:.errors)?$/) { my $Deletion = defined $TTL ? " (deletion in $TTL days)" : ""; Error "Found a suspicious file$Deletion: latest/$Entry\n"; diff --git a/testbot/bin/UpdateTaskLogs b/testbot/bin/UpdateTaskLogs index b2357250..985e1dc0 100755 --- a/testbot/bin/UpdateTaskLogs +++ b/testbot/bin/UpdateTaskLogs @@ -218,7 +218,7 @@ sub DoUpdateLatestReport($$$) my ($Task, $ReportName, $SrcReportPath) = @_;
# Keep the name as is when saving an existing reference report - my $SrcIsRef = ($SrcReportPath =~ /-job\d+-/); + my $SrcIsRef = ($SrcReportPath =~ /-job[0-9.]+-/); my $RefReportName = $SrcIsRef ? basename($SrcReportPath) : $Task->GetRefReportName($ReportName); return 0 if ($LatestFiles{$RefReportName}); @@ -504,11 +504,11 @@ sub ProcessLatestReports() }
# Then perform cleanups and rebuild missing files - foreach my $LatestReportPath (glob("$LatestGlob $LatestGlob.errors")) + foreach my $LatestReportPath (glob("$LatestGlob.report $LatestGlob.report.errors $LatestGlob.log $LatestGlob.log.errors")) { my $RefReportName = basename($LatestReportPath); # Keep the regexp in sync with WineTestBot::Task::GetRefReportName() - next if ($RefReportName !~ /^([a-zA-Z0-9_]+-job[0-9]+-[a-zA-Z0-9_]+.report)(?:.errors)?$/); + next if ($RefReportName !~ /^([a-zA-Z0-9_]+-job[0-9.]+-[a-zA-Z0-9_]+.report)(?:.errors)?$/); $RefReportName = $1; # untaint $LatestReportPath = "$DataDir/latest/$RefReportName"; $Rc += Delete("$LatestReportPath.err"); diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm index f660274e..ab32fc75 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -1745,7 +1745,7 @@ sub _DeduplicateLatestReport($) my ($RefReportName) = @_;
my $LatestGlob = $RefReportName; - $LatestGlob =~ s/-job\d+-/-job*-/; + $LatestGlob =~ s/-job[0-9.]+-/-job*-/; my @LatestPaths = glob("$DataDir/latest/$LatestGlob"); return undef if (@LatestPaths <= 1);
@@ -1762,7 +1762,7 @@ sub _DeduplicateLatestReport($)
my $ErrMessage; my $ReportRE = $RefReportName; - $ReportRE =~ s/^([a-zA-Z0-9_]+)-job\d+-([a-zA-Z0-9_]+)$/\Q$1\E-job[0-9]+-\Q$2/; + $ReportRE =~ s/^([a-zA-Z0-9_]+)-job[0-9.]+-([a-zA-Z0-9_]+)$/\Q$1\E-job[0-9.]+-\Q$2/; foreach my $LogPath (sort { $LatestAges{$a} <=> $LatestAges{$b} } @LatestPaths) { my $LogName = basename($LogPath); diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm index b6332d2d..41ac0c58 100644 --- a/testbot/lib/WineTestBot/Tasks.pm +++ b/testbot/lib/WineTestBot/Tasks.pm @@ -139,7 +139,7 @@ sub GetReportNames($) sub GetRefReportName($$) { my ($self, $ReportName) = @_; - return sprintf("%s-job%06d-%s", $self->VM->Name, $self->JobId, $ReportName); + return sprintf("%s-job%06d.%d.%d-%s", $self->VM->Name, $self->JobId, $self->StepNo, $self->No, $ReportName); }
sub GetRefReportPaths($$;$$) @@ -156,7 +156,7 @@ sub GetRefReportPaths($$;$$) my %RefReportPaths; foreach my $RefReportPath (glob($RefGlob)) { - next if ($RefReportPath !~ m~^\Q$Dir\E/(\Q$VMName\E-job[0-9]+-\Q$ReportName\E)$ExtraRE$~); + next if ($RefReportPath !~ m~^\Q$Dir\E/(\Q$VMName\E-job[0-9.]+-\Q$ReportName\E)$ExtraRE$~); my $RefReportName = $1; # untaint next if ($RefReportPaths{$RefReportName}); $RefReportPaths{$RefReportName} = "$Dir/$RefReportName";