diff options
author | Benoit Foucher <benoit@zeroc.com> | 2019-10-23 15:12:05 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-10-23 15:12:05 +0200 |
commit | 63a6ebefe36192459b7fade97a7f19b1ce6d3e5a (patch) | |
tree | b5e11a72efe27b61f8d4bd2906492d3bc2f1c821 /scripts/Util.py | |
parent | Updated doxygen files (diff) | |
download | ice-63a6ebefe36192459b7fade97a7f19b1ce6d3e5a.tar.bz2 ice-63a6ebefe36192459b7fade97a7f19b1ce6d3e5a.tar.xz ice-63a6ebefe36192459b7fade97a7f19b1ce6d3e5a.zip |
Fixed ./allTests.py bug which would cause unecessary delay when using controllers
Diffstat (limited to 'scripts/Util.py')
-rw-r--r-- | scripts/Util.py | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/scripts/Util.py b/scripts/Util.py index 3850effb6ba..67931169e5a 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -2234,21 +2234,26 @@ class RemoteProcessController(ProcessController): # work we'll wait for 10s for the process controller to register with the registry. # If the wait times out, we retry again. # - nRetry = 0 - while nRetry < 10: - nRetry += 1 - + def callback(future): try: - proxy.ice_ping() + future.result() with self.cond: - self.processControllerProxies[ident] = proxy - return self.processControllerProxies[ident] + if not ident in self.processControllerProxies: + self.processControllerProxies[proxy.ice_getIdentity()] = proxy + self.cond.notifyAll() except Exception: pass + nRetry = 0 + while nRetry < 10: + nRetry += 1 + + if self.supportsDiscovery(): + proxy.ice_pingAsync().add_done_callback(callback) + with self.cond: if not ident in self.processControllerProxies: - self.cond.wait(10) + self.cond.wait(5) if ident in self.processControllerProxies: return self.processControllerProxies[ident] @@ -2276,6 +2281,9 @@ class RemoteProcessController(ProcessController): self.cond.notifyAll() + def supportsDiscovery(self): + return True + def clearProcessController(self, proxy, conn=None): with self.cond: if proxy.ice_getIdentity() in self.processControllerProxies: @@ -2319,6 +2327,12 @@ class RemoteProcessController(ProcessController): self.controllerApps = [] if self.adapter: self.adapter.destroy() + if self.future: + try: + self.future.result() + except Exception as ex: + print(ex) + pass class AndroidProcessController(RemoteProcessController): @@ -2336,6 +2350,9 @@ class AndroidProcessController(RemoteProcessController): def __str__(self): return "Android" + def supportsDiscovery(self): + return self.device is not None # Discovery is only used with devices + def getControllerIdentity(self, current): if isinstance(current.testcase.getMapping(), CSharpMapping): return "AndroidXamarin/ProcessController" @@ -2719,6 +2736,9 @@ class BrowserProcessController(RemoteProcessController): def __str__(self): return str(self.driver) if self.driver else "Manual" + def supportsDiscovery(self): + return False + def getControllerIdentity(self, current): # # Load the controller page each time we're asked for the controller and if we're running @@ -3061,11 +3081,10 @@ class Driver: initData.properties.setProperty("Ice.Plugin.IceDiscovery", "IceDiscovery:createIceDiscovery") initData.properties.setProperty("IceDiscovery.DomainId", "TestController") initData.properties.setProperty("IceDiscovery.Interface", self.interface) - initData.properties.setProperty("IceDiscovery.RetryCount", "10") # Retry 10 times with the default 300ms timeout initData.properties.setProperty("Ice.Default.Host", self.interface) initData.properties.setProperty("Ice.ThreadPool.Server.Size", "10") # initData.properties.setProperty("Ice.Trace.Protocol", "1") - # initData.properties.setProperty("Ice.Trace.Network", "3") + # initData.properties.setProperty("Ice.Trace.Network", "2") # initData.properties.setProperty("Ice.StdErr", "allTests.log") initData.properties.setProperty("Ice.Override.Timeout", "10000") initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000") |