changeset 61:74d878c778c0

Adjust timeouts for the tests.
author shade
date Fri, 11 Oct 2013 22:18:41 +0400
parents db4410e10574
children d9eeb23c2825
files harness/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java
diffstat 1 files changed, 8 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java	Thu Oct 03 16:08:13 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java	Fri Oct 11 22:18:41 2013 +0400
@@ -145,28 +145,16 @@
         testLog.println(s);
     }
 
-    public boolean tryWaitFor(Future<?> f) throws ExecutionException, InterruptedException {
-        try {
-            f.get(1, TimeUnit.SECONDS);
-            return true;
-        } catch (TimeoutException e) {
-            return false;
-        }
-    }
-
     protected void waitFor(ConcurrencyTest test, Collection<Future<?>> tasks) {
         long startTime = System.nanoTime();
         boolean allStopped = false;
         while (!allStopped) {
-            if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) > time * 2) {
-                dumpFailure(test, Status.TIMEOUT_ERROR);
-                return;
-            }
-
             allStopped = true;
             for (Future<?> t : tasks) {
                 try {
-                    allStopped &= tryWaitFor(t);
+                    t.get(1, TimeUnit.SECONDS);
+                } catch (TimeoutException e) {
+                    allStopped = false;
                 } catch (ExecutionException e) {
                     dumpFailure(test, Status.TEST_ERROR, e.getCause());
                     return;
@@ -174,6 +162,11 @@
                     return;
                 }
             }
+
+            if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) > Math.max(time, 60*1000)) {
+                dumpFailure(test, Status.TIMEOUT_ERROR);
+                return;
+            }
         }
     }
 }