[tools 2/2] testbot/WineRun*: Account for any task.log error.

Francois Gouget fgouget at codeweavers.com
Thu Apr 8 05:38:26 CDT 2021


This ensures TestLauncher errors are accounted for in the task result.
Builds are not expected to generate errors in task.log but if they do,
they too should be accounted for.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
In particular this allows the scripts to detect and report the 
TestLauncher wineprefix sanity checks.
---
 testbot/bin/WineRunBuild.pl    |  9 ++++++---
 testbot/bin/WineRunReconfig.pl | 10 +++++++---
 testbot/bin/WineRunTask.pl     |  1 +
 testbot/bin/WineRunWineTest.pl | 11 ++++++++---
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 13f488bd9..8585882b7 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -385,7 +385,7 @@ if (!$Pid)
 # log before giving up
 #
 
-my ($NewStatus, $ErrMessage, $TAError, $TaskTimedOut);
+my ($NewStatus, $ErrMessage, $TaskFailures, $TaskTimedOut, $TAError);
 Debug(Elapsed($Start), " Waiting for the script (", $Task->Timeout, "s timeout)\n");
 if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
 {
@@ -407,12 +407,15 @@ Debug(Elapsed($Start), " Retrieving 'Build.log'\n");
 if ($TA->GetFile("Build.log", "$TaskDir/task.log"))
 {
   my $LogInfo = ParseTaskLog("$TaskDir/task.log");
+  $TaskFailures ||= $LogInfo->{ErrCount};
   if ($LogInfo->{Task} eq "ok")
   {
     # We must have gotten the full log and the build did succeed.
-    # So forget any prior error.
+    # So forget any prior error...
     $NewStatus = "completed";
     $TAError = $ErrMessage = undef;
+    # ...but keep keep the task.log ones
+    $TaskFailures = $LogInfo->{ErrCount};
   }
   elsif ($LogInfo->{Task} eq "badpatch")
   {
@@ -489,4 +492,4 @@ $TA->Disconnect();
 # Wrap up
 #
 
-WrapUpAndExit($NewStatus, undef, undef, $TaskTimedOut);
+WrapUpAndExit($NewStatus, $TaskFailures, undef, $TaskTimedOut);
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 212a5d383..66b2deaaf 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -385,7 +385,7 @@ if (!$Pid)
 # log before giving up
 #
 
-my ($NewStatus, $ErrMessage, $TAError, $TaskTimedOut);
+my ($NewStatus, $ErrMessage, $TaskFailures, $TaskTimedOut, $TAError);
 Debug(Elapsed($Start), " Waiting for the script (", $Task->Timeout, "s timeout)\n");
 if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
 {
@@ -394,6 +394,7 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
   {
     $ErrMessage = "The build timed out\n";
     $NewStatus = "badbuild";
+    $TaskFailures = 1;
     $TaskTimedOut = 1;
   }
   else
@@ -408,12 +409,15 @@ Debug(Elapsed($Start), " Retrieving 'Reconfig.log'\n");
 if ($TA->GetFile("Reconfig.log", "$TaskDir/task.log"))
 {
   $LogInfo = ParseTaskLog("$TaskDir/task.log");
+  $TaskFailures ||= $LogInfo->{ErrCount};
   if ($LogInfo->{Task} eq "ok")
   {
     # We must have gotten the full log and the build did succeed.
-    # So forget any prior error.
+    # So forget any prior error...
     $NewStatus = "completed";
     $TAError = $ErrMessage = undef;
+    # ...but keep keep the task.log ones
+    $TaskFailures = $LogInfo->{ErrCount};
   }
   elsif (defined $LogInfo->{BadLog})
   {
@@ -566,4 +570,4 @@ if ($NewStatus eq 'completed')
 # In case of a regular build failure retrying is pointless. But in case of a
 # timeout the VM host may be less busy next time and since the snapshot is
 # unchanged we can retry.
-WrapUpAndExit($NewStatus, undef, $TaskTimedOut, $TaskTimedOut);
+WrapUpAndExit($NewStatus, $TaskFailures, $TaskTimedOut, $TaskTimedOut);
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 148884328..bb199d126 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -535,6 +535,7 @@ Debug(Elapsed($Start), " Retrieving 'Task.log'\n");
 if ($TA->GetFile("Task.log", "$TaskDir/task.log"))
 {
   my $LogInfo = ParseTaskLog("$TaskDir/task.log");
+  $TaskFailures ||= $LogInfo->{ErrCount};
   my $ErrMessage = CreateLogErrorsCache($LogInfo);
   LogTaskError("$ErrMessage\n") if (defined $ErrMessage);
 }
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index 3a267ace1..c9a57bb86 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -508,19 +508,24 @@ Debug(Elapsed($Start), " Retrieving 'Task.log'\n");
 if ($TA->GetFile("Task.log", "$TaskDir/task.log"))
 {
   my $LogInfo = ParseTaskLog("$TaskDir/task.log");
+  $TaskFailures ||= $LogInfo->{ErrCount};
   if ($LogInfo->{Task} eq "ok")
   {
     # We must have gotten the full log and the task completed successfully
     # (with or without test failures). So clear any previous errors, including
     # $TaskFailures since there was not really a timeout after all.
     $NewStatus = "completed";
-    $TaskFailures = $TAError = $ErrMessage = $PossibleCrash = undef;
+    $TAError = $ErrMessage = $PossibleCrash = undef;
+    # Reset the timeout error but keep the task.log ones
+    $TaskFailures = $LogInfo->{ErrCount};
   }
   elsif ($LogInfo->{Task} eq "badpatch")
   {
     # This too is conclusive enough to ignore other errors.
     $NewStatus = "badpatch";
-    $TaskFailures = $TAError = $ErrMessage = $PossibleCrash = undef;
+    $TAError = $ErrMessage = $PossibleCrash = undef;
+    # Reset the timeout error but keep the keep the task.log ones
+    $TaskFailures = $LogInfo->{ErrCount};
   }
   elsif (defined $LogInfo->{BadLog})
   {
@@ -532,7 +537,7 @@ if ($TA->GetFile("Task.log", "$TaskDir/task.log"))
     $NewStatus = "badbuild";
     $TaskFailures = $PossibleCrash = undef;
   }
-  elsif (!$TaskTimedOut and !defined $TAError)
+  elsif (!$TaskTimedOut and !defined $TAError and !$LogInfo->{ErrCount})
   {
     # Did WineTest.pl crash?
     $NewStatus = "boterror";
-- 
2.20.1



More information about the wine-devel mailing list