Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/CheckForWinetestUpdate.pl | 4 +- testbot/bin/WineRunWineTest.pl | 53 +++++++++++++++++++---- testbot/bin/build/WineTest.pl | 61 ++++++++++++++++++++++++++- testbot/lib/WineTestBot/Config.pm | 8 ++-- testbot/lib/WineTestBot/PatchUtils.pm | 17 +++++++- testbot/lib/WineTestBot/Patches.pm | 5 ++- testbot/web/Submit.pl | 9 ++-- 7 files changed, 133 insertions(+), 24 deletions(-)
diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl index 991cdeb0f..29953642e 100755 --- a/testbot/bin/CheckForWinetestUpdate.pl +++ b/testbot/bin/CheckForWinetestUpdate.pl @@ -215,7 +215,7 @@ sub AddJob($$$) Debug(" $VMKey $Build\n"); my $Task = $Tasks->Add(); $Task->VM($VMs->GetItem($VMKey)); - $Task->Timeout($SuiteTimeout); + $Task->Timeout(GetTestTimeout(undef, { $Build => 1 })); }
# Save it all @@ -318,7 +318,7 @@ sub AddReconfigJob($) my $Task = $NewStep->Tasks->Add(); $Task->VM($VM); $Task->CmdLineArg($Build); - $Task->Timeout($SuiteTimeout); + $Task->Timeout(GetTestTimeout(undef, { $Build => 1 })); } } } diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl index 90e3403f7..0e438f957 100755 --- a/testbot/bin/WineRunWineTest.pl +++ b/testbot/bin/WineRunWineTest.pl @@ -382,7 +382,7 @@ if (!$VM->GetDomain()->IsPoweredOn()) FatalError("The VM is not powered on\n"); }
-if ($Step->Type ne "build" and $Step->Type ne "suite") +if ($Step->Type ne "build" and $Step->Type ne "suite" and $Step->Type ne "single") { FatalError("Unexpected step type '". $Step->Type ."' found\n"); } @@ -422,7 +422,12 @@ if (defined $FileName)
my $Script = "#!/bin/sh\n". "( set -x\n". - " ../bin/build/WineTest.pl "; + " export WINETEST_DEBUG=". $Step->DebugLevel ."\n"; +if ($Step->ReportSuccessfulTests) +{ + $Script .= " export WINETEST_REPORT_SUCCESS=1\n"; +} +$Script .= " ../bin/build/WineTest.pl "; if ($Step->Type eq "suite") { my $BaseTag = BuildTag($VM->Name); @@ -460,7 +465,7 @@ Debug(Elapsed($Start), " Starting the script\n"); my $Pid = $TA->Run(["./task"], 0); if (!$Pid) { - FatalTAError($TA, "Failed to start the task"); + FatalTAError($TA, "Failed to start the test"); }
@@ -530,8 +535,9 @@ elsif (!defined $TAError) $TAError = "An error occurred while retrieving the task log: ". $TA->GetLastError(); }
+ # -# Grab the test logs if any +# Grab the test reports if any #
if ($Step->Type ne "build") @@ -585,14 +591,45 @@ if ($Step->Type ne "build") Debug(Elapsed($Start), " Disconnecting\n"); $TA->Disconnect();
-# Report the task errors even though they may have been caused by -# TestAgent trouble. -LogTaskError($ErrMessage) if (defined $ErrMessage); -FatalTAError(undef, $TAError, $PossibleCrash) if (defined $TAError); + +# +# Grab a copy of the reference logs +# + +# Note that this may be a bit inaccurate right after a Wine commit. +# See WineSendLog.pl for more details. +if ($NewStatus eq 'completed') +{ + my $LatestDir = "$DataDir/latest"; + my $StepDir = $Step->GetDir(); + my $BuildList = $Task->CmdLineArg; + $BuildList =~ s/ .*$//; + foreach my $Build (split /,/, $BuildList) + { + my $RptFileName = "$Build.report"; + my $RefReport = $Task->VM->Name ."_$RptFileName"; + for my $Suffix ("", ".err") + { + if (-f "$LatestDir/$RefReport$Suffix") + { + unlink "$StepDir/$RefReport$Suffix"; + if (!link "$LatestDir/$RefReport$Suffix", "$StepDir/$RefReport$Suffix") + { + Error "Could not link '$RefReport$Suffix': $!\n"; + } + } + } + } +}
# # Wrap up #
+# Report the task errors even though they may have been caused by +# TestAgent trouble. +LogTaskError($ErrMessage) if (defined $ErrMessage); +FatalTAError(undef, $TAError, $PossibleCrash) if (defined $TAError); + WrapUpAndExit($NewStatus, $TaskFailures, undef, $TaskTimedOut); diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl index 9be73a42f..2b26a41ab 100755 --- a/testbot/bin/build/WineTest.pl +++ b/testbot/bin/build/WineTest.pl @@ -107,6 +107,46 @@ sub DailyWineTest($$$$$) return 1; }
+sub TestPatch($$$) +{ + my ($Targets, $Build, $Impacts) = @_; + + return 1 if (!$Targets->{"test$Build"}); + + my @TestList; + foreach my $Module (sort keys %{$Impacts->{Tests}}) + { + my $TestInfo = $Impacts->{Tests}->{$Module}; + if ($TestInfo->{All}) + { + push @TestList, $Module; + } + else + { + foreach my $Unit (sort keys %{$TestInfo->{Units}}) + { + push @TestList, "$Module:$Unit"; + } + } + } + return 1 if (!@TestList); + + InfoMsg "\nRunning the tests in the $Build Wine\n"; + SetupWineEnvironment($Build); + + # Run WineTest. Ignore the exit code since it returns non-zero whenever + # there are test failures. + RunWine($Build, "./programs/winetest/winetest.exe.so", + "-c -o '../$Build.report' -t test-$Build ". join(" ", @TestList)); + if (!-f "$Build.report") + { + LogMsg "WineTest did not produce a report file\n"; + return 0; + } + + return 1; +} +
# # Setup and command line processing @@ -226,6 +266,20 @@ if (!defined $Usage) $Usage = 2; } } + else + { + foreach my $Build ("win32", "wow32", "wow64") + { + $Targets->{"test$Build"} = 1 if ($Targets->{$Build}); + } + if ($Targets->{"wow32"} or $Targets->{"wow64"}) + { + # Always rebuild both WoW targets before running the tests to make sure + # we don't run into issues caused by the two Wine builds being out of + # sync. + $Targets->{"wow32"} = $Targets->{"wow64"} = 1; + } + }
if (!defined $FileName and $Action eq "testpatch") { @@ -247,7 +301,7 @@ if (defined $Usage) print "Tests the specified patch or runs WineTest in Wine.\n"; print "\n"; print "Where:\n"; - print " --testpatch Verify that the patch compiles.\n"; + print " --testpatch Verify that the patch compiles and run the impacted tests.\n"; print " --winetest Run WineTest and submit the result to the website.\n"; print " --no-submit Do not submit the WineTest results to the website.\n"; print " TARGETS Is a comma-separated list of targets for the specified action.\n"; @@ -282,7 +336,10 @@ if ($Action eq "testpatch") exit(1) if (!$Impacts or !BuildWine($Targets, "win32") or !BuildWine($Targets, "wow64") or - !BuildWine($Targets, "wow32")); + !BuildWine($Targets, "wow32") or + !TestPatch($Targets, "win32", $Impacts) or + !TestPatch($Targets, "wow64", $Impacts) or + !TestPatch($Targets, "wow32", $Impacts)); } elsif ($Action eq "winetest") { diff --git a/testbot/lib/WineTestBot/Config.pm b/testbot/lib/WineTestBot/Config.pm index 157617780..44692295e 100644 --- a/testbot/lib/WineTestBot/Config.pm +++ b/testbot/lib/WineTestBot/Config.pm @@ -33,7 +33,7 @@ use vars qw (@ISA @EXPORT @EXPORT_OK $UseSSL $LogDir $DataDir $BinDir $WinePatchToOverride $WinePatchCc $ExeBuildNativeTimeout $ExeBuildTestTimeout $ExeModuleTimeout $WineBuildTimeout $WineModuleTimeout $TimeoutMargin - $SuiteTimeout $SingleTimeout $MaxUnitSize + $SuiteTimeout $SingleTimeout $SingleAvgTime $MaxUnitSize $TagPrefix $ProjectName $PatchesMailingList $LDAPServer $LDAPBindDN $LDAPSearchBase $LDAPSearchFilter $LDAPRealNameAttribute $LDAPEMailAttribute $AgentPort $Tunnel @@ -49,7 +49,7 @@ require Exporter; $RobotEMail $WinePatchToOverride $WinePatchCc $SuiteTimeout $ExeBuildNativeTimeout $ExeBuildTestTimeout $ExeModuleTimeout $WineBuildTimeout $WineModuleTimeout $TimeoutMargin - $SuiteTimeout $SingleTimeout $MaxUnitSize + $SuiteTimeout $SingleTimeout $SingleAvgTime $MaxUnitSize $TagPrefix $ProjectName $PatchesMailingList $LDAPServer $LDAPBindDN $LDAPSearchBase $LDAPSearchFilter $LDAPRealNameAttribute $LDAPEMailAttribute $AgentPort $Tunnel @@ -112,8 +112,10 @@ $TimeoutMargin = 2 * 60; # Test timeouts (in seconds) # - For the whole test suite $SuiteTimeout = 30 * 60; -# - For a single test +# - For the first two tests $SingleTimeout = 2 * 60; +# - For extra tests +$SingleAvgTime = 2;
# Maximum amount of traces for a test unit. $MaxUnitSize = 32 * 1024; diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm index f03cc40bb..502a781f6 100644 --- a/testbot/lib/WineTestBot/PatchUtils.pm +++ b/testbot/lib/WineTestBot/PatchUtils.pm @@ -32,7 +32,7 @@ the Wine builds.
use Exporter 'import'; our @EXPORT = qw(GetPatchImpacts LastPartSeparator UpdateWineData - GetBuildTimeout); + GetBuildTimeout GetTestTimeout);
use List::Util qw(min max);
@@ -478,4 +478,19 @@ sub GetBuildTimeout($$) return $ExeTimeout + $WineTimeout; }
+sub GetTestTimeout($$) +{ + my ($Impacts, $Builds) = @_; + + my $Timeout = $SuiteTimeout; + if ($Impacts) + { + my $UnitCount = $Impacts->{TestUnitCount}; + my $TestsTimeout = min(2, $UnitCount) * $SingleTimeout + + max(0, $UnitCount - 2) * $SingleAvgTime; + $Timeout = min($SuiteTimeout, $TestsTimeout); + } + return scalar(keys %$Builds) * $Timeout; +} + 1; diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm index 96e4a0dda..f685e86b3 100644 --- a/testbot/lib/WineTestBot/Patches.pm +++ b/testbot/lib/WineTestBot/Patches.pm @@ -245,7 +245,7 @@ sub Submit($$$) my $NewStep = $NewJob->Steps->Add(); $NewStep->FileName("patch.diff"); $NewStep->FileType("patch"); - $NewStep->Type("build"); + $NewStep->Type("single"); $NewStep->DebugLevel(0);
# And a task for each VM @@ -258,7 +258,8 @@ sub Submit($$$) $Task->VM($VM); # Only verify that the win32 version compiles my $Builds = { "win32" => 1 }; - $Task->Timeout(GetBuildTimeout($Impacts, $Builds)); + $Task->Timeout(GetBuildTimeout($Impacts, $Builds) + + GetTestTimeout($Impacts, $Builds)); $Task->CmdLineArg(join(",", keys %$Builds)); } } diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl index 9ad8fd5e0..d0da7a249 100644 --- a/testbot/web/Submit.pl +++ b/testbot/web/Submit.pl @@ -276,10 +276,6 @@ sub GenerateFields($) $Status = " [". $VM->Status ."]"; $Checked = undef; } - elsif ($VM->Type eq "wine") - { - $Checked = undef; - } if ($Checked and ($self->GetParam("Page") == 1 || $self->GetParam($FieldName))) { @@ -876,7 +872,7 @@ sub SubmitJob($$$) my $WineStep = $Steps->Add(); $WineStep->FileName($BaseName); $WineStep->FileType($FileType); - $WineStep->Type("build"); + $WineStep->Type("single"); $WineStep->DebugLevel($self->GetParam("DebugLevel")); $WineStep->ReportSuccessfulTests(defined($self->GetParam("ReportSuccessfulTests"))); $Tasks = $WineStep->Tasks; @@ -884,7 +880,8 @@ sub SubmitJob($$$) if (!defined $Timeout) { my $Builds = { $Build => 1 }; - $Timeout = GetBuildTimeout($Impacts, $Builds); + $Timeout = GetBuildTimeout($Impacts, $Builds) + + GetTestTimeout($Impacts, $Builds); }
# Then add a task for this VM