Francois Gouget : testbot/LogUtils: Better report log access errors.

Alexandre Julliard julliard at winehq.org
Mon Jan 27 14:14:27 CST 2020


Module: tools
Branch: master
Commit: ae308cb87ffb9d8be56dfa47393fe9e6d403e34f
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=ae308cb87ffb9d8be56dfa47393fe9e6d403e34f

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Jan 27 03:29:14 2020 +0100

testbot/LogUtils: Better report log access errors.

GetLogErrors() now sets $LogInfo->{BadLog} when it fails to open a log
file. This makes it easier for the caller to identify the issue and
report it.
Similarly TagNewErrors() sets $LogInfo->{BadRef} when it cannot access the
reference log.
Furthermore TagNewErrors() also sets $LogInfo->{NoRef} when no reference
log could be used to detect new errors, either because the reference log
could not be accessed or because there was no reference log in the first
place.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/WineSendLog.pl          |  2 +-
 testbot/lib/WineTestBot/LogUtils.pm | 33 ++++++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index fdf7e24..44d7255 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -295,7 +295,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 d05a811..81cff51 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -730,6 +730,9 @@ per dll / program being tested).
 Returns a hashtable containing:
 =over
 
+=item BadLog
+Contains an error message if the log could not be read.
+
 =item ErrCount
 The number of errors. This is undefined if no log file was found.
 
@@ -800,8 +803,9 @@ sub GetLogErrors($)
   }
   elsif (-f $LogFileName)
   {
+    $LogInfo->{BadLog} = "Could not open '". basename($LogFileName) ."' for reading: $!";
     my $Group = _AddLogGroup($LogInfo, "TestBot errors");
-    _AddLogError($LogInfo, $Group, "Could not open '". basename($LogFileName) ."' for reading: $!");
+    _AddLogError($LogInfo, $Group, $LogInfo->{BadLog});
   }
 
   if (open(my $LogFile, "<", "$LogFileName.err"))
@@ -825,8 +829,9 @@ sub GetLogErrors($)
   }
   elsif (-f "$LogFileName.err")
   {
+    $LogInfo->{BadLog} ||= "Could not open '". basename($LogFileName) .".err' for reading: $!";
     my $Group = _AddLogGroup($LogInfo, "TestBot errors");
-    _AddLogError($LogInfo, $Group, "Could not open '". basename($LogFileName) .".err' for reading: $!");
+    _AddLogError($LogInfo, $Group, $LogInfo->{BadLog});
   }
 
   return $LogInfo;
@@ -899,8 +904,16 @@ 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
@@ -922,16 +935,18 @@ sub TagNewErrors($$)
 {
   my ($RefLogPath, $LogInfo) = @_;
 
-  if (!$LogInfo->{ErrCount})
+  return if (!$LogInfo->{ErrCount});
+
+  my $RefInfo = GetLogErrors($RefLogPath);
+  if (defined $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}})
   {




More information about the wine-cvs mailing list