8227247: tools/sjavac/IdleShutdown.java fails with AssertionError: Error too big on windows
authormbaesken
Wed, 10 Jul 2019 11:11:30 +0200
changeset 55731 ee23bd3192f7
parent 55730 94f8a0b34117
child 55732 5f3df8029bfd
8227247: tools/sjavac/IdleShutdown.java fails with AssertionError: Error too big on windows Reviewed-by: jjg, stuefe
test/langtools/tools/sjavac/IdleShutdown.java
--- a/test/langtools/tools/sjavac/IdleShutdown.java	Wed Jul 17 15:12:47 2019 -0700
+++ b/test/langtools/tools/sjavac/IdleShutdown.java	Wed Jul 10 11:11:30 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,13 @@
 
         long error = Math.abs(expectedTimeout - timeoutTimestamp.get());
         log("Timeout error: " + error + " ms");
-        if (error > TIMEOUT_MS * .1)
-            throw new AssertionError("Error too big");
-
+        String timeoutFactorText = System.getProperty("test.timeout.factor", "1.0");
+        double timeoutFactor = Double.parseDouble(timeoutFactorText);
+        double allowedError = TIMEOUT_MS * 0.1 * timeoutFactor;
+        if (error > allowedError) {
+            throw new AssertionError("Timeout error too large, error is " + error +
+                                     " milliseconds, we allowed " + allowedError + " milliseconds");
+        }
         log("Shutting down");
         service.shutdown();
     }