changeset 55985:aadee41c39a3 fibers

Fix intermittent test failure
author alanb
date Mon, 01 Jul 2019 14:39:46 +0100
parents 8260cd94e2dd
children 40cdbdac00bc
files test/jdk/java/lang/Fiber/Scopes.java
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/Fiber/Scopes.java	Sat Jun 29 13:23:00 2019 +0100
+++ b/test/jdk/java/lang/Fiber/Scopes.java	Mon Jul 01 14:39:46 2019 +0100
@@ -334,8 +334,8 @@
         }
         joinUninterruptibly(fiber);
         Thread.interrupted();
-        long seconds = Duration.between(start, Instant.now()).toSeconds();
-        assertTrue(seconds >= 2 && seconds <= 5);
+        long millis = Duration.between(start, Instant.now()).toMillis();
+        assertTrue(millis >= 1900 && millis <= 5000, "Duration " + millis + "ms");
     }
 
     // fiber owner, outer scope has deadline, inner scope has later deadline
@@ -361,8 +361,8 @@
         }
         joinUninterruptibly(fiber);
         Thread.interrupted();
-        long seconds = Duration.between(start, Instant.now()).toSeconds();
-        assertTrue(seconds >= 2 && seconds <= 5);
+        long millis = Duration.between(start, Instant.now()).toMillis();
+        assertTrue(millis >= 1900 && millis <= 5000, "Duration " + millis + "ms");
     }
 
     // fiber owner, outer scope has deadline, deeply nested inner scope has later deadline
@@ -403,9 +403,8 @@
         }
         joinUninterruptibly(fiber);
         Thread.interrupted();
-
-        long seconds = Duration.between(start, Instant.now()).toSeconds();
-        assertTrue(seconds >= 3);
+        long millis = Duration.between(start, Instant.now()).toMillis();
+        assertTrue(millis >= 2900, "Duration " + millis + "ms");
     }
 
     // fiber owner, outer scope has deadline, schedule fiber in inner ignore-cancel scope