This implies not assuming that the mission's build uniquely identifies the testing environment. Let GetMissionBaseName() deal with coming up with a suitable identifier for the wineprefix and test reports.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
This lays the groundwork for testing a given build in multiple locales.
testbot/bin/WineRunWineTest.pl | 12 ++++----- testbot/bin/build/WineReconfig.pl | 9 ++++--- testbot/bin/build/WineTest.pl | 38 ++++++++++++++--------------- testbot/lib/Build/Utils.pm | 24 ++++++++++-------- testbot/lib/WineTestBot/Missions.pm | 8 +++++- 5 files changed, 51 insertions(+), 40 deletions(-)
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl index 3784ef0657..592162ad7b 100755 --- a/testbot/bin/WineRunWineTest.pl +++ b/testbot/bin/WineRunWineTest.pl @@ -290,10 +290,10 @@ sub WrapUpAndExit($;$$$)
if ($Step->Type eq 'suite' and $Status eq 'completed' and !$TimedOut) { - foreach my $Build (keys %{$TaskMissions->{Builds}}) + foreach my $Mission (@{$TaskMissions->{Missions}}) { # Keep the old report if the new one is missing - my $RptFileName = "$Build.report"; + my $RptFileName = GetMissionBaseName($Mission) .".report"; if (-f "$TaskDir/$RptFileName" and !-z "$TaskDir/$RptFileName") { # Update the VM's reference WineTest results for WineSendLog.pl @@ -549,9 +549,9 @@ elsif (!defined $TAError) # Grab the test reports if any #
-foreach my $Build (keys %{$TaskMissions->{Builds}}) +foreach my $Mission (@{$TaskMissions->{Missions}}) { - my $RptFileName = "$Build.report"; + my $RptFileName = GetMissionBaseName($Mission) .".report"; Debug(Elapsed($Start), " Retrieving '$RptFileName'\n"); if ($TA->GetFile($RptFileName, "$TaskDir/$RptFileName")) { @@ -606,9 +606,9 @@ if ($NewStatus eq 'completed') { my $LatestDir = "$DataDir/latest"; my $StepDir = $Step->GetDir(); - foreach my $Build (keys %{$TaskMissions->{Builds}}) + foreach my $Mission (@{$TaskMissions->{Missions}}) { - my $RptFileName = "$Build.report"; + my $RptFileName = GetMissionBaseName($Mission) .".report"; my $RefReport = $Task->VM->Name ."_$RptFileName"; for my $Suffix ("", ".err") { diff --git a/testbot/bin/build/WineReconfig.pl b/testbot/bin/build/WineReconfig.pl index 898f72c5b6..cc25da0cc8 100755 --- a/testbot/bin/build/WineReconfig.pl +++ b/testbot/bin/build/WineReconfig.pl @@ -103,17 +103,18 @@ 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. + # time. Note that this requires using a different wineprefix for each + # mission. foreach my $Mission (@{$TaskMissions->{Missions}}) { next if ($Mission->{test} eq "build");
- SetupWineEnvironment($Mission->{Build}); - InfoMsg "\nRecreating the $Mission->{Build} wineprefix\n"; + my $BaseName = SetupWineEnvironment($Mission); + InfoMsg "\nRecreating the $BaseName wineprefix\n";
# Wait for the wineprefix creation to complete so it is really done # before the snapshot gets updated. - my $ErrMessage = CreateWinePrefix($Mission->{Build}, "wait"); + my $ErrMessage = CreateWinePrefix($Mission, "wait"); if (defined $ErrMessage) { LogMsg "$ErrMessage\n"; diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl index 6df028fa95..4947a12a62 100755 --- a/testbot/bin/build/WineTest.pl +++ b/testbot/bin/build/WineTest.pl @@ -84,34 +84,34 @@ sub SetupTest($$) LogMsg "tests\n" if (!$InTests); $InTests = 1;
- InfoMsg "\nRunning $Test in the $Mission->{Build} Wine\n"; - SetupWineEnvironment($Mission->{Build}); + my $BaseName = SetupWineEnvironment($Mission); + InfoMsg "\nRunning $Test in the $BaseName Wine\n"; + return $BaseName; }
sub DailyWineTest($$$$) { my ($Mission, $NoSubmit, $BaseTag, $Args) = @_;
- SetupTest("WineTest", $Mission); + my $BaseName = SetupTest("WineTest", $Mission);
# Run WineTest. Ignore the exit code since it returns non-zero whenever # there are test failures. - my $Tag = SanitizeTag("$BaseTag-$Mission->{Build}"); - RunWine($Mission->{Build}, "./programs/winetest/winetest.exe.so", - "-c -o '../$Mission->{Build}.report' -t $Tag ". - ShArgv2Cmd(@$Args)); - if (!-f "$Mission->{Build}.report") + my $Tag = SanitizeTag("$BaseTag-$BaseName"); + RunWine($Mission, "./programs/winetest/winetest.exe.so", + "-c -o '../$BaseName.report' -t $Tag ". ShArgv2Cmd(@$Args)); + if (!-f "$BaseName.report") { - LogMsg "WineTest did not produce a report file\n"; + LogMsg "WineTest did not produce the $BaseName report\n"; return 0; }
# Send the report to the website if ((!$NoSubmit and !$Mission->{nosubmit}) and - RunWine($Mission->{Build}, "./programs/winetest/winetest.exe.so", - "-c -s '../$Mission->{Build}.report'")) + RunWine($Mission, "./programs/winetest/winetest.exe.so", + "-c -s '../$BaseName.report'")) { - LogMsg "WineTest failed to send the $Mission->{Build} report\n"; + LogMsg "WineTest failed to send the $BaseName report\n"; # Soldier on in case it's just a network issue }
@@ -153,26 +153,26 @@ sub TestPatch($$) return 1 if (!@TestList); }
- SetupTest("the tests", $Mission); + my $BaseName = 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"; + LogMsg "Could not create the $BaseName wineprefix: $ErrMessage\n"; return 0; } }
# Run WineTest. Ignore the exit code since it returns non-zero whenever # there are test failures. - RunWine($Mission->{Build}, "./programs/winetest/winetest.exe.so", - "-c -o '../$Mission->{Build}.report' -t test-$Mission->{Build} ". + RunWine($Mission, "./programs/winetest/winetest.exe.so", + "-c -o '../$BaseName.report' -t do.not.submit ". join(" ", @TestList)); - if (!-f "$Mission->{Build}.report") + if (!-f "$BaseName.report") { - LogMsg "WineTest did not produce a report file\n"; + LogMsg "WineTest did not produce the $BaseName report\n"; return 0; }
@@ -365,7 +365,7 @@ if ($DataDir =~ /'/) #
# Clean up old reports -map { unlink("$_.report") } keys %{$TaskMissions->{Builds}}; +unlink map { GetMissionBaseName($_) .".report" } @{$TaskMissions->{Missions}};
my $Impacts; if ($Action eq "testpatch") diff --git a/testbot/lib/Build/Utils.pm b/testbot/lib/Build/Utils.pm index aa5c205d2d..06fb3d87fc 100644 --- a/testbot/lib/Build/Utils.pm +++ b/testbot/lib/Build/Utils.pm @@ -36,6 +36,7 @@ use Digest::SHA; use File::Path;
use WineTestBot::Config; +use WineTestBot::Missions; use WineTestBot::PatchUtils; use WineTestBot::Utils;
@@ -327,19 +328,22 @@ sub UpdateAddOns()
sub SetupWineEnvironment($) { - my ($Build) = @_; + my ($Mission) = @_;
- $ENV{WINEPREFIX} = "$DataDir/wineprefix-$Build"; + my $BaseName = GetMissionBaseName($Mission); + $ENV{WINEPREFIX} = "$DataDir/wineprefix-$BaseName"; $ENV{DISPLAY} ||= ":0.0"; + + return $BaseName; }
sub RunWine($$$) { - my ($Build, $Cmd, $CmdArgs) = @_; + my ($Mission, $Cmd, $CmdArgs) = @_;
- my $Magic = `cd '$DataDir/wine-$Build' && file $Cmd`; + my $Magic = `cd '$DataDir/wine-$Mission->{Build}' && file $Cmd`; my $Wine = ($Magic =~ /ELF 64/ ? "./wine64" : "./wine"); - return system("cd '$DataDir/wine-$Build' && set -x && ". + return system("cd '$DataDir/wine-$Mission->{Build}' && set -x && ". "time $Wine $Cmd $CmdArgs"); }
@@ -348,24 +352,24 @@ sub RunWine($$$) # WinePrefix helpers #
-sub CreateWinePrefix($$) +sub CreateWinePrefix($;$) { - my ($Build, $Wait) = @_; + my ($Mission, $Wait) = @_;
return "$WINEPREFIX is not set!" if (!$ENV{WINEPREFIX}); rmtree($ENV{WINEPREFIX});
# Crash dialogs cause delays so disable them - if (RunWine($Build, "./programs/reg/reg.exe.so", "ADD HKCU\\Software\\Wine\\WineDbg /v ShowCrashDialog /t REG_DWORD /d 0")) + if (RunWine($Mission, "./programs/reg/reg.exe.so", "ADD HKCU\\Software\\Wine\\WineDbg /v ShowCrashDialog /t REG_DWORD /d 0")) { - return "Failed to disable the $Build build crash dialogs: $!"; + return "Failed to disable the crash dialogs: $!"; }
if ($Wait) { # Ensure the WinePrefix has been fully created and the registry files # saved before returning. - system("cd '$DataDir/wine-$Build' && ./server/wineserver -w"); + system("cd '$DataDir/wine-$Mission->{Build}' && ./server/wineserver -w"); }
return undef; diff --git a/testbot/lib/WineTestBot/Missions.pm b/testbot/lib/WineTestBot/Missions.pm index 80c1d97227..0dc812d6ba 100644 --- a/testbot/lib/WineTestBot/Missions.pm +++ b/testbot/lib/WineTestBot/Missions.pm @@ -26,7 +26,7 @@ WineTestBot::Missions - Missions parser and helper functions =cut
use Exporter 'import'; -our @EXPORT = qw(DumpMissions ParseMissionStatement +our @EXPORT = qw(DumpMissions GetMissionBaseName ParseMissionStatement MergeMissionStatementTasks SplitMissionStatementTasks);
@@ -86,6 +86,12 @@ sub ParseMissionStatement($) return (undef, @Missions); }
+sub GetMissionBaseName($) +{ + my ($Mission) = @_; + return $Mission->{Build}; +} + sub MergeMissionStatementTasks($) { my ($MissionStatement) = @_;