[3/4] testbot: Better document the use of the staging directory.
Francois Gouget
fgouget at codeweavers.com
Tue May 6 19:34:55 CDT 2014
Also remove an unused variable in CheckForWinetestUpdate.
---
testbot/bin/CheckForWinetestUpdate.pl | 13 +++++++++----
testbot/web/Submit.pl | 6 ++++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index 5d30913..98165a3 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -175,7 +175,11 @@ umask 002;
mkdir "$DataDir/latest";
mkdir "$DataDir/staging";
-my $LatestFileName = "$DataDir/latest/winetest${BitsSuffix}-latest.exe";
+# Store the new WineTest executable in the staging directory:
+# - So we can compare it to the reference one in the latest directory to
+# check that it is truly new.
+# - Because we don't know the relevant Job and Step IDs yet and thus cannot
+# put it in the jobs directory tree.
my $FileNameRandomPart = GenerateRandomString(32);
while (-e "$DataDir/staging/${FileNameRandomPart}_winetest${BitsSuffix}-latest.exe")
{
@@ -186,7 +190,7 @@ my $StagingFileName = "$DataDir/staging/${FileNameRandomPart}_winetest${BitsSuff
my $UA = LWP::UserAgent->new();
$UA->agent("WineTestBot");
my $Request = HTTP::Request->new(GET => $WinetestUrl);
-my $NowDate = gmtime;
+my $LatestFileName = "$DataDir/latest/winetest${BitsSuffix}-latest.exe";
if (-r $LatestFileName)
{
my $Since = gmtime((stat $LatestFileName)[9]);
@@ -230,14 +234,15 @@ if ($Bits == 32)
{
AddReconfigJob();
AddJob(1, $FileNameRandomPart, $Bits);
-
+
+ # Create another copy for the non-base VMs Job.
$FileNameRandomPart = GenerateRandomString(32);
while (-e "$DataDir/staging/${FileNameRandomPart}_winetest-latest.exe")
{
$FileNameRandomPart = GenerateRandomString(32);
}
$StagingFileName = "$DataDir/staging/${FileNameRandomPart}_winetest-latest.exe";
- if (! copy($LatestFileName, $StagingFileName))
+ if (!copy($LatestFileName, $StagingFileName))
{
LogMsg "Can't copy $LatestFileName to $StagingFileName: $!\n";
}
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index f73ae6a..4773da5 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -792,8 +792,10 @@ sub OnSubmit
return !1;
}
- # Make sure the file has a unique name even when not picked up directly
- # by the engine
+ # Store the file in the staging directory until the relevant Job and Step
+ # IDs are known and it can be moved to the jobs directory tree. But rename
+ # it so it does not get overwritten if the user submits another one before
+ # the Engine gets around to doing so.
my $FileNameRandomPart = $self->GetCurrentSession()->Id;
while (-e ("$DataDir/staging/${FileNameRandomPart}_" .
$self->GetParam("FileName")))
--
2.0.0.rc0
More information about the wine-patches
mailing list