Module: tools
Branch: master
Commit: 508e7bbb3943f2dc989cf7c90b871651dee950a8
URL: https://source.winehq.org/git/tools.git/?a=commit;h=508e7bbb3943f2dc989cf7c…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Sun Oct 28 23:49:17 2018 +0100
testbot: Detect if a task failed before starting the tests.
This makes it possible to reliably report build issues as such.
It also helps improve handling of build script and VM crashes.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/WineRunBuild.pl | 2 +-
testbot/bin/WineRunReconfig.pl | 2 +-
testbot/bin/WineRunWineTest.pl | 36 +++++++++++++++++++-----------------
testbot/bin/build/WineTest.pl | 19 +++++++++++++++----
testbot/lib/WineTestBot/LogUtils.pm | 7 ++++---
5 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 21d2e8b..5a3a683 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -406,7 +406,7 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
Debug(Elapsed($Start), " Retrieving 'Build.log'\n");
if ($TA->GetFile("Build.log", "$TaskDir/log"))
{
- my $Result = ParseTaskLog("$TaskDir/log");
+ my ($Result, $_Type) = ParseTaskLog("$TaskDir/log");
if ($Result eq "ok")
{
# We must have gotten the full log and the build did succeed.
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 02eee8c..e7e5573 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -388,7 +388,7 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
Debug(Elapsed($Start), " Retrieving 'Reconfig.log'\n");
if ($TA->GetFile("Reconfig.log", "$TaskDir/log"))
{
- my $Result = ParseTaskLog("$TaskDir/log");
+ my ($Result, $_Type) = ParseTaskLog("$TaskDir/log");
if ($Result eq "ok")
{
# We must have gotten the full log and the build did succeed.
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index f47a024..5b6eb33 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -490,14 +490,9 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
if ($ErrMessage =~ /timed out waiting for the child process/)
{
$ErrMessage = "The task timed out\n";
- if ($Step->Type eq "build")
- {
- $NewStatus = "badbuild";
- }
- else
- {
- $TaskFailures = 1;
- }
+ # We don't know if the timeout was caused by the build or the tests.
+ # Until we get the task log assume it's the tests' fault.
+ $TaskFailures = 1;
$TaskTimedOut = 1;
}
else
@@ -511,30 +506,37 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60))
Debug(Elapsed($Start), " Retrieving 'Task.log'\n");
if ($TA->GetFile("Task.log", "$TaskDir/log"))
{
- my $Result = ParseTaskLog("$TaskDir/log");
+ my ($Result, $Type) = ParseTaskLog("$TaskDir/log");
if ($Result eq "ok")
{
- # We must have gotten the full log and the build did succeed.
- # So forget any prior error.
+ # 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";
- $TAError = $ErrMessage = undef;
+ $TaskFailures = $TAError = $ErrMessage = $PossibleCrash = undef;
}
elsif ($Result eq "badpatch")
{
# This too is conclusive enough to ignore other errors.
$NewStatus = "badpatch";
- $TAError = $ErrMessage = undef;
+ $TaskFailures = $TAError = $ErrMessage = $PossibleCrash = undef;
}
elsif ($Result =~ s/^nolog://)
{
FatalError("$Result\n", "retry");
}
- elsif ($Result ne "missing" or $Step->Type ne "suite")
+ elsif ($Type eq "build")
{
- # There is no build and thus no result line when running WineTest.
- # Otherwise if the result line is missing we probably already have an
- # error message that explains why.
+ # The error happened before the tests started so blame the build.
$NewStatus = "badbuild";
+ $TaskFailures = $PossibleCrash = undef;
+ }
+ elsif (!$TaskTimedOut and !defined $TAError)
+ {
+ # Did WineTest.pl crash?
+ $NewStatus = "boterror";
+ $TaskFailures = undef;
+ $PossibleCrash = 1;
}
}
elsif (!defined $TAError)
diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl
index 32830b0..0b14b68 100755
--- a/testbot/bin/build/WineTest.pl
+++ b/testbot/bin/build/WineTest.pl
@@ -75,12 +75,24 @@ sub BuildWine($$)
# Test helpers
#
+my $InTests;
+
+sub SetupTest($$)
+{
+ my ($Test, $Mission) = @_;
+
+ LogMsg "tests\n" if (!$InTests);
+ $InTests = 1;
+
+ InfoMsg "\n$Running $Test in the $Mission->{Build} Wine\n";
+ SetupWineEnvironment($Mission->{Build});
+}
+
sub DailyWineTest($$$$)
{
my ($Mission, $NoSubmit, $BaseTag, $Args) = @_;
- InfoMsg "\nRunning WineTest in the $Mission->{Build} Wine\n";
- SetupWineEnvironment($Mission->{Build});
+ SetupTest("WineTest", $Mission);
# Run WineTest. Ignore the exit code since it returns non-zero whenever
# there are test failures.
@@ -128,8 +140,7 @@ sub TestPatch($$)
}
return 1 if (!@TestList);
- InfoMsg "\nRunning the tests in the $Mission->{Build} Wine\n";
- SetupWineEnvironment($Mission->{Build});
+ SetupTest("the tests", $Mission);
# Run WineTest. Ignore the exit code since it returns non-zero whenever
# there are test failures.
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 4751f75..59b2d0a 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -80,12 +80,13 @@ sub ParseTaskLog($)
if (open(my $LogFile, "<", $FileName))
{
my $Result;
+ my $Type = "build";
foreach my $Line (<$LogFile>)
{
chomp $Line;
if ($Line eq "Task: tests")
{
- ; # Ignore it for now
+ $Type = "tests";
}
elsif ($Line eq "Task: ok")
{
@@ -102,9 +103,9 @@ sub ParseTaskLog($)
}
}
close($LogFile);
- return $Result || "missing";
+ return ($Result || "missing", $Type);
}
- return "nolog:Unable to open the task log for reading: $!";
+ return ("nolog:Unable to open the task log for reading: $!", undef);
}