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($$$$$$)