Francois Gouget : testbot: Add a function to check the TestAgentd version.

Alexandre Julliard julliard at winehq.org
Mon Oct 28 14:51:13 CDT 2019


Module: tools
Branch: master
Commit: 4685e47d431a0945390931f8940e89fe4b53d6b3
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=4685e47d431a0945390931f8940e89fe4b53d6b3

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Oct 28 07:13:19 2019 +0100

testbot: Add a function to check the TestAgentd version.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 127c15c..bc45533 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 a4d32ec..6c4e644 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($$$$$$)




More information about the wine-cvs mailing list