Francois Gouget : testbot: Adopt the missions syntax for *Build.pl.
Alexandre Julliard
julliard at winehq.org
Tue Oct 23 08:48:38 CDT 2018
Module: tools
Branch: master
Commit: 6fb501c5838e330e8884089e5890541c0b9ac291
URL: https://source.winehq.org/git/tools.git/?a=commit;h=6fb501c5838e330e8884089e5890541c0b9ac291
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Mon Oct 22 03:05:14 2018 +0200
testbot: Adopt the missions syntax for *Build.pl.
This makes it possible to specify mission options on the command line
if necessary.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/bin/WineRunBuild.pl | 6 ++---
testbot/bin/build/Build.pl | 59 +++++++++++++++++++++++++--------------------
2 files changed, 36 insertions(+), 29 deletions(-)
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index ec36b62..21d2e8b 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -339,13 +339,13 @@ if ($Step->FileType ne "patch")
# Figure out what to build
#
-my (%Builds, %TestExes);
+my (%Missions, %TestExes);
foreach my $TestStep (@{$Job->Steps->GetItems()})
{
if (($TestStep->PreviousNo || 0) == $Step->No and
$TestStep->FileType =~ /^exe/)
{
- $Builds{$TestStep->FileType} = 1;
+ $Missions{$TestStep->FileType} = 1;
$TestExes{$TestStep->FileName} = $TestStep->FileType;
}
}
@@ -364,7 +364,7 @@ if (!$TA->SendFile($FileName, "staging/patch.diff", 0))
}
my $Script = "#!/bin/sh\n".
"( set -x\n".
- " ../bin/build/Build.pl patch.diff ". join(":", sort keys %Builds) ."\n".
+ " ../bin/build/Build.pl patch.diff ". join(":", sort keys %Missions) ."\n".
") >Build.log 2>&1\n";
Debug(Elapsed($Start), " Sending the script: [$Script]\n");
if (!$TA->SendFileFromString($Script, "task", $TestAgent::SENDFILE_EXE))
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index 54b1aea..b50a25c 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -46,6 +46,7 @@ sub BEGIN
use Build::Utils;
use WineTestBot::Config;
+use WineTestBot::Missions;
use WineTestBot::Utils;
@@ -71,9 +72,9 @@ sub BuildNative()
sub BuildTestExecutables($$$)
{
- my ($Targets, $Impacts, $Build) = @_;
+ my ($TaskMissions, $Impacts, $Build) = @_;
- return 1 if (!$Targets->{$Build});
+ return 1 if (!$TaskMissions->{Builds}->{$Build});
my (@BuildDirs, @TestExes);
foreach my $TestInfo (values %{$Impacts->{Tests}})
@@ -116,10 +117,7 @@ sub BuildTestExecutables($$$)
$ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
delete $ENV{ENV};
-my %AllTargets;
-map { $AllTargets{$_} = 1 } qw(exe32 exe64);
-
-my ($Usage, $PatchFile, $TargetList);
+my ($Usage, $PatchFile, $MissionStatement);
while (@ARGV)
{
my $Arg = shift @ARGV;
@@ -152,9 +150,9 @@ while (@ARGV)
last;
}
}
- elsif (!defined $TargetList)
+ elsif (!defined $MissionStatement)
{
- $TargetList = $Arg;
+ $MissionStatement = $Arg;
}
else
{
@@ -165,7 +163,7 @@ while (@ARGV)
}
# Check and untaint parameters
-my $Targets;
+my $TaskMissions;
if (!defined $Usage)
{
if (!defined $PatchFile)
@@ -174,17 +172,26 @@ if (!defined $Usage)
$Usage = 2;
}
- $TargetList = join(",", keys %AllTargets) if (!defined $TargetList);
- foreach my $Target (split /[,:]/, $TargetList)
+ $MissionStatement = "exe32:exe64" if (!defined $MissionStatement);
+ my ($ErrMessage, $Missions) = ParseMissionStatement($MissionStatement);
+ if (defined $ErrMessage)
{
- $Target = "exe$1" if ($Target =~ /^(32|64)$/);
- if (!$AllTargets{$Target})
- {
- Error "invalid target name $Target\n";
- $Usage = 2;
- last;
- }
- $Targets->{$Target} = 1;
+ Error "$ErrMessage\n";
+ $Usage = 2;
+ }
+ elsif (!@$Missions)
+ {
+ Error "Empty mission statement\n";
+ $Usage = 2;
+ }
+ elsif (@$Missions > 1)
+ {
+ Error "Cannot specify missions for multiple tasks\n";
+ $Usage = 2;
+ }
+ else
+ {
+ $TaskMissions = $Missions->[0];
}
}
if (defined $Usage)
@@ -195,16 +202,16 @@ if (defined $Usage)
Error "try '$Name0 --help' for more information\n";
exit $Usage;
}
- print "Usage: $Name0 [--help] PATCHFILE TARGETS\n";
+ print "Usage: $Name0 [--help] PATCHFILE [MISSIONS]\n";
print "\n";
print "Applies the specified patch and rebuilds the Wine test executables.\n";
print "\n";
print "Where:\n";
print " PATCHFILE Is the staging file containing the patch to build.\n";
- print " TARGETS Is a comma-separated list of build targets. By default every\n";
- print " target is run.\n";
- print " - exe32: Rebuild the 32 bit Windows test executables.\n";
- print " - exe64: Rebuild the 64 bit Windows test executables.\n";
+ print " MISSIONS Is a colon-separated list of missions. By default all supported\n";
+ print " missions are run.\n";
+ print " - exe32: Build the 32 bit Windows test executables.\n";
+ print " - exe64: Build the 64 bit Windows test executables.\n";
print " --help Shows this usage message.\n";
exit 0;
}
@@ -224,8 +231,8 @@ my $Impacts = ApplyPatch("wine", $PatchFile);
if (!$Impacts or
($Impacts->{PatchedRoot} and !BuildNative()) or
- !BuildTestExecutables($Targets, $Impacts, "exe32") or
- !BuildTestExecutables($Targets, $Impacts, "exe64"))
+ !BuildTestExecutables($TaskMissions, $Impacts, "exe32") or
+ !BuildTestExecutables($TaskMissions, $Impacts, "exe64"))
{
exit(1);
}
More information about the wine-cvs
mailing list