If set to 'all', then any non-test patch will cause a full WineTest run. If set to 'module', then only the patched module's tests will be run. If set to 'test' or unset, then the current behavior is preserved so that only patched test units are run. If set to 'build', then only verify that the patch builds.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/build/WineReconfig.pl | 8 +++-- testbot/bin/build/WineTest.pl | 43 ++++++++++++++++++++------- testbot/lib/WineTestBot/Missions.pm | 6 +++- testbot/lib/WineTestBot/PatchUtils.pm | 25 +++++++++++----- testbot/web/admin/VMDetails.pl | 1 + 5 files changed, 62 insertions(+), 21 deletions(-)
diff --git a/testbot/bin/build/WineReconfig.pl b/testbot/bin/build/WineReconfig.pl index f46408b469..53ce319032 100755 --- a/testbot/bin/build/WineReconfig.pl +++ b/testbot/bin/build/WineReconfig.pl @@ -104,13 +104,15 @@ sub UpdateWinePrefixes($) # Set up brand new WinePrefixes ready for use for testing. # This way we do it once instead of doing it for every test, thus saving # time. Note that this requires using a different wineprefix for each build. - foreach my $Build ("win32", "wow64", "wow32") + foreach my $Mission (@{$TaskMissions->{Missions}}) { - next if (!$TaskMissions->{Builds}->{$Build}); + next if ($Mission->{test} eq "build"); + + SetupWineEnvironment($Build); + InfoMsg "\nRecreating the $Mission->{Build} wineprefix\n";
# Wait for the wineprefix creation to complete so it is really done # before the snapshot gets updated. - SetupWineEnvironment($Build); my $ErrMessage = CreateWinePrefix($Build, "wait"); if (defined $ErrMessage) { diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl index c74d1f6562..893a74dd59 100755 --- a/testbot/bin/build/WineTest.pl +++ b/testbot/bin/build/WineTest.pl @@ -122,25 +122,48 @@ sub TestPatch($$) { my ($Mission, $Impacts) = @_;
+ return 1 if ($Mission->{test} eq "build"); + my @TestList; - foreach my $Module (sort keys %{$Impacts->{Tests}}) + if ($Mission->{test} eq "all" and + ($Impacts->{PatchedRoot} or $Impacts->{PatchedModules})) { - my $TestInfo = $Impacts->{Tests}->{$Module}; - if ($TestInfo->{All}) - { - push @TestList, $Module; - } - else + push @TestList, "-m", "do.not.submit"; + } + else + { + foreach my $Module (sort keys %{$Impacts->{Tests}}) { - foreach my $Unit (sort keys %{$TestInfo->{Units}}) + my $TestInfo = $Impacts->{Tests}->{$Module}; + if ($TestInfo->{All} or + ($Mission->{test} eq "module" and $TestInfo->{PatchedModule})) { - push @TestList, "$Module:$Unit"; + # When given a module name WineTest runs all its tests. + # But make sure the module actually has tests first! + push @TestList, $Module if (%{$TestInfo->{Units}}); + } + else + { + foreach my $Unit (sort keys %{$TestInfo->{Units}}) + { + push @TestList, "$Module:$Unit"; + } } } + return 1 if (!@TestList); } - return 1 if (!@TestList);
SetupTest("the tests", $Mission); + if (!-d $ENV{WINEPREFIX}) + { + # FIXME Wait for the wineserver as a workaround for bug 41713. + my $ErrMessage = CreateWinePrefix($Mission, "wait"); + if (defined $ErrMessage) + { + LogMsg "Could not create the $Mission->{Build} wineprefix: $ErrMessage\n"; + return 0; + } + }
# Run WineTest. Ignore the exit code since it returns non-zero whenever # there are test failures. diff --git a/testbot/lib/WineTestBot/Missions.pm b/testbot/lib/WineTestBot/Missions.pm index 58b33403fb..80c1d97227 100644 --- a/testbot/lib/WineTestBot/Missions.pm +++ b/testbot/lib/WineTestBot/Missions.pm @@ -64,7 +64,11 @@ sub ParseMissionStatement($) } $Build = $1; # untaint $TaskMissions->{Builds}->{$Build} = 1; - my $Mission = { Build => $Build, Statement => $Statement }; + my $Mission = { + Build => $Build, + Statement => $Statement, + test => "test", # Set the default value + }; push @{$TaskMissions->{Missions}}, $Mission;
foreach my $Option (@Options) diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm index fb4f88650f..0e17a70002 100644 --- a/testbot/lib/WineTestBot/PatchUtils.pm +++ b/testbot/lib/WineTestBot/PatchUtils.pm @@ -492,15 +492,26 @@ sub GetTestTimeout($$) { my ($Impacts, $TaskMissions) = @_;
- my $Timeout = $SuiteTimeout; - if ($Impacts) + my $Timeout = 0; + foreach my $Mission (@{$TaskMissions->{Missions}}) { - my $UnitCount = $Impacts->{TestUnitCount}; - my $TestsTimeout = min(2, $UnitCount) * $SingleTimeout + - max(0, $UnitCount - 2) * $SingleAvgTime; - $Timeout = min($SuiteTimeout, $TestsTimeout); + if (!$Impacts or ($Mission->{test} eq "all" and + ($Impacts->{PatchedRoot} or $Impacts->{PatchedModules}))) + { + $Timeout += $SuiteTimeout; + } + elsif ($Mission->{test} ne "build") + { + # Note: If only test units have been patched then + # ModuleUnitCount == TestUnitCount. + my $UnitCount = $Mission->{test} eq "test" ? $Impacts->{TestUnitCount} : + $Impacts->{ModuleUnitCount}; + my $TestsTimeout = min(2, $UnitCount) * $SingleTimeout + + max(0, $UnitCount - 2) * $SingleAvgTime; + $Timeout += min($SuiteTimeout, $TestsTimeout); + } } - return @{$TaskMissions->{Missions}} * $Timeout; + return $Timeout; }
1; diff --git a/testbot/web/admin/VMDetails.pl b/testbot/web/admin/VMDetails.pl index 5f49c684d8..4b7799a8cf 100644 --- a/testbot/web/admin/VMDetails.pl +++ b/testbot/web/admin/VMDetails.pl @@ -78,6 +78,7 @@ sub GenerateFooter($) print "Each mission is composed of a build and options separated by commas: <i>build,option1=value,option2,...</i>. The value can be omitted for boolean options and defaults to true.<br>\n"; print "The supported builds are <i>build</i> for build VMs; <i>exe32</i> and <i>exe64</i> for Windows VMs;<i> win32</i>, <i>wow32</i> and <i>wow64</i> for Wine VMs.</p>\n"; print "<p>On Wine VMs:<br>\n"; + print "The <i>test</i> option can be set to <i>build</i> to only test building, <i>test</i> to only rerun patched tests, <i>module</i> to rerun all of a patched dll or program's tests, or <i>all</i> to always rerun all the tests.<br>\n"; print "If set, the <i>nosubmit</i> option specifies that the WineTest results should not be published online.</p>\n"; print "</td></tr></tbody>\n"; print "</table></div>\n";