Module: tools Branch: master Commit: 78cbe16aa7c0166bf21e0b7d1a8a5fee11f50b6c URL: https://gitlab.winehq.org/winehq/tools/-/commit/78cbe16aa7c0166bf21e0b7d1a8a...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Jun 26 16:47:05 2023 +0200
testbot: Keep reference copies of the Wine test task.log files.
They can contain warnings and errors too so the TestBot should keep reference files too to detect new entries.
---
testbot/bin/UpdateTaskLogs | 15 ++++++++++----- testbot/bin/WineRunWineTest.pl | 2 +- testbot/lib/WineTestBot/LogUtils.pm | 23 +++++++++++++++++------ 3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/testbot/bin/UpdateTaskLogs b/testbot/bin/UpdateTaskLogs index 985e1dc0..eef3e522 100755 --- a/testbot/bin/UpdateTaskLogs +++ b/testbot/bin/UpdateTaskLogs @@ -355,7 +355,7 @@ sub ProcessTaskLogs($$$$) { # Save / delete the task's reference reports... all of them, # even if they were not supposed to exist (e.g. failed builds). - foreach my $ReportName (@$ReportNames) + foreach my $ReportName (@$ReportNames, "task.log") { # Also match the files related/derived from the report for the cleanup my $RefReportPaths = $Task->GetRefReportPaths($ReportName, "(?:.err|.errors)?"); @@ -402,6 +402,10 @@ sub ProcessTaskLogs($$$$) # Take a snapshot of the reference reports older than this Task foreach my $ReportName (@{GetLogFileNames($TaskDir)}) { + next if ($ReportName eq "testbot.log"); + # For Wine test tasks, only snapshot the task.log reference files that + # match a xxx.report report. + next if ($ReportName eq "task.log" and $Step->Type !~ /^(?:build|reconfig)$/); Debug(TaskKeyStr($Task) .": Snapshotting the reference reports for $ReportName\n"); my $ErrMessages = SnapshotLatestReport($Task, $ReportName); foreach my $ErrMessage (@$ErrMessages) @@ -467,7 +471,8 @@ sub ProcessTaskLogs($$$$) { foreach my $ReportName (@{GetLogFileNames($TaskDir)}) { - next if ($Step->Type eq "suite" and $ReportName !~ /.report$/); + next if ($ReportName eq "testbot.log"); + next if ($ReportName eq "task.log" and $Task->VM->Type =~ /^win(?:32|64)$/); next if ($Step->Type eq "reconfig" and $ReportName !~ /.log$/); next if (-z "$TaskDir/$ReportName"); $Rc += DoUpdateLatestReport($Task, $ReportName, "$TaskDir/$ReportName"); @@ -481,10 +486,10 @@ sub ProcessTaskLogs($$$$) sub ProcessLatestReports() { my $Rc = 0; - my $LatestGlob = "$DataDir/latest/*.report"; + my $LatestGlob = "$DataDir/latest/*";
# Delete or rename the old reference reports - foreach my $LatestReportPath (glob("$LatestGlob $LatestGlob.err")) + foreach my $LatestReportPath (glob("$LatestGlob.report $LatestGlob.report.err")) { my $RefReportName = basename($LatestReportPath); next if ($RefReportName !~ /^([a-zA-Z0-9_]+_[a-zA-Z0-9_]+.report)(?:.err)?$/); @@ -508,7 +513,7 @@ sub ProcessLatestReports() { 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_]+.(?:log|report))(?:.errors)?$/); $RefReportName = $1; # untaint $LatestReportPath = "$DataDir/latest/$RefReportName"; $Rc += Delete("$LatestReportPath.err"); diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl index d685f819..002e7f3b 100755 --- a/testbot/bin/WineRunWineTest.pl +++ b/testbot/bin/WineRunWineTest.pl @@ -301,7 +301,7 @@ sub WrapUpAndExit($;$$$$$$$$) # case of a timeout. if ($Step->Type eq 'suite' and $Status eq 'completed' and !$TimedOut) { - my $ErrMessages = UpdateLatestReports($Task, @$ReportNames); + my $ErrMessages = UpdateLatestReports($Task, [@$ReportNames, "task.log"]); Error("$_\n") for (@$ErrMessages); }
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm index 8ea2dd50..40cf2c1e 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -1674,8 +1674,8 @@ sub CreateLogErrorsCache($;$)
Takes a snapshot of the reference WineTest results for the specified Task.
-The reference reports are used to identify new failures, even long after the task has -been run. +The reference reports are used to identify new failures, even long after the +task has been run.
Note also that comparing reports in this way may be a bit inaccurate right after a Wine commit due to delays in getting new WineTest results, etc. @@ -1699,12 +1699,23 @@ sub SnapshotLatestReport($$) # Ignore reference results more recent than the report next if ($ReportAge and -M $RefReportPath <= $ReportAge);
- foreach my $Suffix ("", ".errors") + my @RefNames = ($RefReportName, "$RefReportName.errors"); + if ($ReportName ne "task.log") { - unlink "$TaskDir/$RefReportName$Suffix"; - if (!link("$RefReportPath$Suffix", "$TaskDir/$RefReportName$Suffix")) + # For non-build tasks, also snapshot the corresponding task.log file + my $TaskLog = $RefReportName; + $TaskLog =~ s/-$ReportName$/-task.log/; + if (-f "$DataDir/latest/$TaskLog") { - push @ErrMessages, "Could not create the '$RefReportName$Suffix' link: $!"; + push @RefNames, $TaskLog, "$TaskLog.errors"; + } + } + foreach my $RefName (@RefNames) + { + unlink "$TaskDir/$RefName"; + if (!link("$DataDir/latest/$RefName", "$TaskDir/$RefName")) + { + push @ErrMessages, "Could not create the '$RefName' link: $!"; } } }