changeset 55731:ee23bd3192f7

8227247: tools/sjavac/IdleShutdown.java fails with AssertionError: Error too big on windows Reviewed-by: jjg, stuefe
author mbaesken
date Wed, 10 Jul 2019 11:11:30 +0200
parents 94f8a0b34117
children 5f3df8029bfd
files test/langtools/tools/sjavac/IdleShutdown.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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();
     }