8227247: tools/sjavac/IdleShutdown.java fails with AssertionError: Error too big on windows
authormbaesken
Wed, 10 Jul 2019 11:11:30 +0200
changeset 57495 d67e0dfc0674
parent 57494 ec3103bb9f6c
child 57496 a0c8d45954a6
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	Thu Jul 18 12:29:57 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();
     }