[10/25] testbot/LogUtils: Add BadRef/NoRef to TagNewErrors().

Francois Gouget fgouget at codeweavers.com
Tue Jan 14 09:41:59 CST 2020


These two fields make it easier to detect and handle cases where there
was no usable reference log for the new error detection.
---
 testbot/bin/WineSendLog.pl          |  2 +-
 testbot/lib/WineTestBot/LogUtils.pm | 26 ++++++++++++++++++--------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 89e90c40f..b31d1f5d3 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -294,7 +294,7 @@ EOF
       my $AllNew;
       my $RefReportPath = $StepTask->GetFullFileName($StepTask->GetRefReportName($LogName));
       TagNewErrors($RefReportPath, $LogInfo);
-      if (!defined $LogInfo->{NewCount})
+      if ($LogInfo->{NoRef})
       {
         # Test reports should have reference WineTest results and if not
         # reporting the errors as new would cause false positives.
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 3714941fc..dd98024bd 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -902,14 +902,22 @@ Compares the specified errors to the reference report to identify new errors.
 The $LogInfo structure is augmented with the following fields:
 =over
 
+=item BadRef
+Contains an error message if the reference log could not be read.
+
+=item NoRef
+True if there was no usable reference log. This could either mean that there
+was no reference log or that the reference log could not be read in which case
+BadRef would be set.
+
 =item NewCount
-The total number of new errors or undef if the reference log could not be read.
+The total number of new errors if any.
 
 =item ErrGroups
 =over
 
 =item NewCount
-A count of the new errors.
+A count of the group's new errors if any.
 
 =item IsNew
 An array where entries are set to true to identify new errors.
@@ -924,16 +932,18 @@ sub TagNewErrors($$)
 {
   my ($RefLogPath, $LogInfo) = @_;
 
-  if (!$LogInfo->{ErrCount})
+  return if (!$LogInfo->{ErrCount});
+
+  my $RefInfo = GetLogErrors($RefLogPath);
+  if ($RefInfo->{BadLog})
   {
-    $LogInfo->{NewCount} = 0;
+    # Save the BadLog error but do not tag the errors as new: this is up to
+    # the caller.
+    $LogInfo->{BadRef} = $RefInfo->{BadLog} if (-e $RefLogPath);
+    $LogInfo->{NoRef} = 1;
     return;
   }
 
-  my $RefInfo = GetLogErrors($RefLogPath);
-  # Don't tag the errors as new if there is no reference log
-  return if (!defined $RefInfo->{ErrCount});
-
   $LogInfo->{NewCount} = 0;
   foreach my $GroupName (@{$LogInfo->{ErrGroupNames}})
   {
-- 
2.20.1




More information about the wine-devel mailing list