Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/LibvirtTool.pl | 3 +-- testbot/lib/WineTestBot/TestAgent.pm | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index 127c15c5c..bc45533d2 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -392,8 +392,7 @@ sub SetupTestAgentd($$$$) # We want 'TestAgentd --detach --show-restarts' on Windows but this was # not supported before this version and changing how the server is started # is too complex. - $Version = sprintf("%02d.%02d", $1, $2); - if ($Version lt "01.07") + if (!$TA->HasMinVersion(1, 7)) { FatalError("The TestAgent server is too old to be upgraded: $Version\n"); } diff --git a/testbot/lib/WineTestBot/TestAgent.pm b/testbot/lib/WineTestBot/TestAgent.pm index a4d32ec27..6c4e6444d 100644 --- a/testbot/lib/WineTestBot/TestAgent.pm +++ b/testbot/lib/WineTestBot/TestAgent.pm @@ -1081,16 +1081,27 @@ sub GetVersion($) { my ($self) = @_;
- if (!$self->{agentversion}) - { - # Retrieve the server version - $self->_Connect(); - } + # Retrieve the server version + $self->_Connect() if (!$self->{agentversion}); + # And return the version we got. # If the connection failed it will be undef as expected. return $self->{agentversion}; }
+sub HasMinVersion($$$) +{ + my ($self, $MinMajor, $MinMinor) = @_; + + # Retrieve the server version + $self->_Connect() if (!$self->{agentversion}); + + return undef if (!$self->{agentversion}); + return undef if ($self->{agentversion} !~ / ([0-9]+).([0-9]+)$/); + my ($Major, $Minor) = ($1, $2); + return (($Major > $MinMajor) or ($Major == $MinMajor and $Minor >= $MinMinor)); +} + our $SENDFILE_EXE = 1;
sub _SendStringOrFile($$$$$$)
Before 1.7 handling redirections was broken and in fact broke TestAgentd itself. So don't redirect the batch file stdout and stderr for these old versions.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
I thought TestAgentd <= 1.6 was just not doing the redirections but it also loses the client connections. The telltale sign is this error:
unable to open 'exe32.report' for reading: No such file or directory
This check will avoid the error until all VMs have been upgraded. I also downgraded the role of the impacted VMs (only w7u and vista afaict) to extra so we don't run the wine-patches tasks on them until this patch / workaround is in.
testbot/bin/WineRunTask.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl index 674495222..0177e05ed 100755 --- a/testbot/bin/WineRunTask.pl +++ b/testbot/bin/WineRunTask.pl @@ -508,7 +508,8 @@ if (!$TA->SendFileFromString($Script, "script.bat", $TestAgent::SENDFILE_EXE)) #
Debug(Elapsed($Start), " Starting the script\n"); -my $Pid = $TA->Run(["./script.bat"], 0, undef, "Task.log", "Task.log"); +my $TaskLog = $TA->HasMinVersion(1, 7) ? "Task.log" : undef; +my $Pid = $TA->Run(["./script.bat"], 0, undef, $TaskLog, $TaskLog); if (!$Pid) { FatalTAError($TA, "Failed to start the test"); @@ -539,10 +540,13 @@ if (!defined $TA->Wait($Pid, $Timeout, $Keepalive)) } }
-Debug(Elapsed($Start), " Retrieving 'Task.log'\n"); -if (!$TA->GetFile("Task.log", "$TaskDir/log") and !defined $TAError) +if (defined $TaskLog) { - $TAError = "An error occurred while retrieving the task log: ". $TA->GetLastError(); + Debug(Elapsed($Start), " Retrieving 'Task.log'\n"); + if (!$TA->GetFile($TaskLog, "$TaskDir/log") and !defined $TAError) + { + $TAError = "An error occurred while retrieving the task log: ". $TA->GetLastError(); + } }
Debug(Elapsed($Start), " Retrieving the report file to '$RptFileName'\n");