diff options
author | Benoit Foucher <benoit@zeroc.com> | 2019-09-04 15:12:56 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-09-04 15:12:56 +0200 |
commit | 7b498dd62dde372cdc586e94c9a98c3ec89157b6 (patch) | |
tree | 3bc3d853a0aa76bb1526b6b212a7629326c5e6bf | |
parent | Fixed Ice/retry test timing (diff) | |
download | ice-7b498dd62dde372cdc586e94c9a98c3ec89157b6.tar.bz2 ice-7b498dd62dde372cdc586e94c9a98c3ec89157b6.tar.xz ice-7b498dd62dde372cdc586e94c9a98c3ec89157b6.zip |
Fixed Ice/acm test waitForClose timing
-rw-r--r-- | cpp/test/Ice/acm/AllTests.cpp | 10 | ||||
-rw-r--r-- | csharp/test/Ice/acm/AllTests.cs | 12 | ||||
-rw-r--r-- | java-compat/test/src/main/java/test/Ice/acm/AllTests.java | 29 | ||||
-rw-r--r-- | java/test/src/main/java/test/Ice/acm/AllTests.java | 33 | ||||
-rw-r--r-- | objective-c/test/Ice/acm/AllTests.m | 17 | ||||
-rw-r--r-- | python/test/Ice/acm/AllTests.py | 10 | ||||
-rw-r--r-- | swift/test/Ice/acm/AllTests.swift | 9 |
7 files changed, 19 insertions, 101 deletions
diff --git a/cpp/test/Ice/acm/AllTests.cpp b/cpp/test/Ice/acm/AllTests.cpp index d9e81d9370d..01a049e87c8 100644 --- a/cpp/test/Ice/acm/AllTests.cpp +++ b/cpp/test/Ice/acm/AllTests.cpp @@ -246,10 +246,10 @@ public: IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); while(!_closed) { - timedWait(IceUtil::Time::seconds(2)); - if(IceUtil::Time::now(IceUtil::Time::Monotonic) - now > IceUtil::Time::seconds(1)) + timedWait(IceUtil::Time::seconds(30)); + if(IceUtil::Time::now(IceUtil::Time::Monotonic) - now > IceUtil::Time::seconds(30)) { - test(false); // Waited for more than 2s for close, something's wrong. + test(false); // Waited for more than 30s for close, something's wrong. } } } @@ -408,8 +408,6 @@ public: virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr&) { - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(3000)); // Idle for 3 seconds - waitForClosed(); Lock sync(*this); @@ -462,7 +460,6 @@ public: } adapter->activate(); - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1000)); waitForClosed(); } @@ -481,7 +478,6 @@ public: virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr&) { adapter->hold(); - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(3000)); // Idle for 3 seconds waitForClosed(); diff --git a/csharp/test/Ice/acm/AllTests.cs b/csharp/test/Ice/acm/AllTests.cs index e409a429fb5..9dd931e5e20 100644 --- a/csharp/test/Ice/acm/AllTests.cs +++ b/csharp/test/Ice/acm/AllTests.cs @@ -244,10 +244,10 @@ namespace Ice long now = IceInternal.Time.currentMonotonicTimeMillis(); while(!_closed) { - Monitor.Wait(this, 2000); - if(IceInternal.Time.currentMonotonicTimeMillis() - now > 2000) + Monitor.Wait(this, 30000); + if(IceInternal.Time.currentMonotonicTimeMillis() - now > 30000) { - System.Diagnostics.Debug.Assert(false); // Waited for more than 2s for close, something's wrong. + System.Diagnostics.Debug.Assert(false); // Waited for more than 30s for close, something's wrong. throw new System.Exception(); } } @@ -405,8 +405,6 @@ namespace Ice public override void runTestCase(Test.RemoteObjectAdapterPrx adapter, Test.TestIntfPrx proxy) { - Thread.Sleep(3000); // Idle for 3 seconds - waitForClosed(); lock(this) { @@ -460,8 +458,6 @@ namespace Ice } adapter.activate(); - Thread.Sleep(1000); - waitForClosed(); } } @@ -477,8 +473,6 @@ namespace Ice public override void runTestCase(Test.RemoteObjectAdapterPrx adapter, Test.TestIntfPrx proxy) { adapter.hold(); - Thread.Sleep(3000); // Idle for 3 seconds - waitForClosed(); lock(this) { diff --git a/java-compat/test/src/main/java/test/Ice/acm/AllTests.java b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java index f5311c80991..0d08d24ac20 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java @@ -250,10 +250,10 @@ public class AllTests long now = IceInternal.Time.currentMonotonicTimeMillis(); try { - wait(2000); - if(IceInternal.Time.currentMonotonicTimeMillis() - now > 2000) + wait(30000); + if(IceInternal.Time.currentMonotonicTimeMillis() - now > 30000) { - test(false); // Waited for more than 2s for close, something's wrong. + test(false); // Waited for more than 30s for close, something's wrong. } } catch(java.lang.InterruptedException ex) @@ -405,14 +405,6 @@ public class AllTests public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy) { - try - { - Thread.sleep(3000); // Idle for 3 seconds - } - catch(java.lang.InterruptedException ex) - { - } - waitForClosed(); synchronized(this) @@ -479,14 +471,6 @@ public class AllTests } adapter.activate(); - try - { - Thread.sleep(1000); - } - catch(java.lang.InterruptedException ex) - { - } - waitForClosed(); } } @@ -502,13 +486,6 @@ public class AllTests public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy) { adapter.hold(); - try - { - Thread.sleep(3000); // Idle for 3 seconds - } - catch(java.lang.InterruptedException ex) - { - } waitForClosed(); synchronized(this) { diff --git a/java/test/src/main/java/test/Ice/acm/AllTests.java b/java/test/src/main/java/test/Ice/acm/AllTests.java index 64921b3fe6c..7f15c314d52 100644 --- a/java/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java/test/src/main/java/test/Ice/acm/AllTests.java @@ -237,10 +237,10 @@ public class AllTests long now = com.zeroc.IceInternal.Time.currentMonotonicTimeMillis(); try { - wait(2000); - if(com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() - now > 2000) + wait(30000); + if(com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() - now > 30000) { - test(false); // Waited for more than 2s for close, something's wrong. + test(false); // Waited for more than 30s for close, something's wrong. } } catch(java.lang.InterruptedException ex) @@ -370,8 +370,7 @@ public class AllTests public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy) { - // No close on invocation, the call should succeed this - // time. + // No close on invocation, the call should succeed this time. proxy.sleep(3); synchronized(this) @@ -392,16 +391,7 @@ public class AllTests public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy) { - try - { - Thread.sleep(3000); // Idle for 3 seconds - } - catch(java.lang.InterruptedException ex) - { - } - waitForClosed(); - synchronized(this) { test(_heartbeat == 0); @@ -466,14 +456,6 @@ public class AllTests } adapter.activate(); - try - { - Thread.sleep(1000); - } - catch(java.lang.InterruptedException ex) - { - } - waitForClosed(); } } @@ -489,13 +471,6 @@ public class AllTests public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy) { adapter.hold(); - try - { - Thread.sleep(3000); // Idle for 3 seconds - } - catch(java.lang.InterruptedException ex) - { - } waitForClosed(); synchronized(this) { diff --git a/objective-c/test/Ice/acm/AllTests.m b/objective-c/test/Ice/acm/AllTests.m index 2ef6672720d..801e0578f4b 100644 --- a/objective-c/test/Ice/acm/AllTests.m +++ b/objective-c/test/Ice/acm/AllTests.m @@ -300,8 +300,8 @@ NSDate* start = [NSDate date]; while(!_closed) { - [_cond waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:2]]; - if(start.timeIntervalSinceNow > -1) + [_cond waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:30]]; + if(start.timeIntervalSinceNow < -30) { test(NO); } @@ -535,10 +535,6 @@ } -(void) runTestCase:(id<TestACMRemoteObjectAdapterPrx>)__unused adapter proxy:(id<TestACMTestIntfPrx>)__unused proxy { - [_cond lock]; - [_cond waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]]; // Idle for 3 seconds - [_cond unlock]; - [self waitForClosed]; [_cond lock]; @@ -631,10 +627,6 @@ } [adapter activate]; - [_cond lock]; - [_cond waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; - [_cond unlock]; - [self waitForClosed]; } @end @@ -659,11 +651,6 @@ -(void) runTestCase:(id<TestACMRemoteObjectAdapterPrx>)adapter proxy:(id<TestACMTestIntfPrx>)__unused proxy { [adapter hold]; - - [_cond lock]; - [_cond waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]]; // Idle for 3 seconds - [_cond unlock]; - [self waitForClosed]; [_cond lock]; diff --git a/python/test/Ice/acm/AllTests.py b/python/test/Ice/acm/AllTests.py index 4b2479b5dd2..56dd17e7ebb 100644 --- a/python/test/Ice/acm/AllTests.py +++ b/python/test/Ice/acm/AllTests.py @@ -128,8 +128,8 @@ class TestCase(threading.Thread): with self.m: while not self._closed: now = time.time() - self.m.wait(2.0) # Wait 2s - if time.time() - now > 2: + self.m.wait(30.0) # Wait 30s + if time.time() - now > 30.0: test(False) def runTestCase(self, adapter, proxy): @@ -218,8 +218,6 @@ def allTests(helper, communicator): self.setClientACM(1, 1, 0) # Only close on idle. def runTestCase(self, adapter, proxy): - time.sleep(3) # Idle for 3 seconds - self.waitForClosed() with self.m: @@ -256,8 +254,6 @@ def allTests(helper, communicator): test(not self._closed) # Not closed yet because of graceful close. adapter.activate() - time.sleep(1) - self.waitForClosed() class ForcefulCloseOnIdleAndInvocationTest(TestCase): @@ -267,8 +263,6 @@ def allTests(helper, communicator): def runTestCase(self, adapter, proxy): adapter.hold() - time.sleep(3) # Idle for 3 seconds - self.waitForClosed() with self.m: diff --git a/swift/test/Ice/acm/AllTests.swift b/swift/test/Ice/acm/AllTests.swift index 5a85a165790..a3188db4b80 100644 --- a/swift/test/Ice/acm/AllTests.swift +++ b/swift/test/Ice/acm/AllTests.swift @@ -249,8 +249,8 @@ class TestCase { } } - if _semaphore.wait(timeout: .now() + Double(2)) == .timedOut { - precondition(false) // Waited for more than 2s for close, something's wrong. + if _semaphore.wait(timeout: .now() + Double(30)) == .timedOut { + precondition(false) // Waited for more than 30s for close, something's wrong. } precondition(_closed) } @@ -356,8 +356,6 @@ class CloseOnIdleTest: TestCase { } override func runTestCase(adapter _: RemoteObjectAdapterPrx, proxy _: TestIntfPrx) throws { - Thread.sleep(forTimeInterval: 3) // Idle for 3 seconds - waitForClosed() try withLock(&_lock) { try _helper.test(self._heartbeat == 0) @@ -401,8 +399,6 @@ class CloseOnIdleAndInvocationTest: TestCase { } try adapter.activate() - Thread.sleep(forTimeInterval: 1) - waitForClosed() } } @@ -415,7 +411,6 @@ class ForcefulCloseOnIdleAndInvocationTest: TestCase { override func runTestCase(adapter: RemoteObjectAdapterPrx, proxy _: TestIntfPrx) throws { try adapter.hold() - Thread.sleep(forTimeInterval: 3) // Idle for 3 seconds waitForClosed() try withLock(&_lock) { try _helper.test(self._heartbeat == 0) |