changeset 3501:2d65e127e93d jdk-9+125

8150860: Mach 5 tier1 test started failing - jdk/jshell/ComputeFQNsTest.java (after 8131027/8150814) Summary: Correctly escaping '\' in paths; rethrowing exceptions from evaluation to improve debuggability of the test Reviewed-by: jjg
author jlahoda
date Mon, 27 Jun 2016 09:43:12 +0200
parents a1fb25b5ee6d
children f557de3af5f9 d213ecfb98b2 cc8b6351da75
files test/jdk/jshell/ComputeFQNsTest.java
diffstat 1 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/jshell/ComputeFQNsTest.java	Fri Jun 24 16:00:43 2016 -0700
+++ b/test/jdk/jshell/ComputeFQNsTest.java	Mon Jun 27 09:43:12 2016 +0200
@@ -76,8 +76,8 @@
         assertInferredFQNs("class X { ArrayList", "ArrayList".length(), false, "java.util.ArrayList");
     }
 
-    @Test(enabled = false) //JDK-8150860
-    public void testSuspendIndexing() throws Exception {
+    @Test
+    public void testSuspendIndexing() throws Throwable {
         compiler.compile(outDir, "package test; public class FQNTest { }");
         String jarName = "test.jar";
         compiler.jar(outDir, jarName, "test/FQNTest.class");
@@ -90,15 +90,35 @@
 
         getState().sourceCodeAnalysis();
 
+        Throwable[] evalException = new Throwable[1];
+
         new Thread() {
             @Override public void run() {
-                assertEval("{new java.io.FileOutputStream(\"" + runMarkFile.toAbsolutePath().toString() + "\").close();" +
-                           " while (java.nio.file.Files.exists(java.nio.file.Paths.get(\"" + continueMarkFile.toString() + "\"))) Thread.sleep(100); }");
+                try {
+                    assertEval("{new java.io.FileOutputStream(\"" + runMarkFile.toAbsolutePath().toString().replace("\\", "\\\\") + "\").close();" +
+                               " while (java.nio.file.Files.exists(java.nio.file.Paths.get(\"" + continueMarkFile.toAbsolutePath().toString().replace("\\", "\\\\") + "\"))) Thread.sleep(100); }");
+                } catch (Throwable t) {
+                    evalException[0] = t;
+                }
             }
         }.start();
 
-        while (!Files.exists(runMarkFile))
-            Thread.sleep(100);
+        while (true) {
+            if (Files.exists(runMarkFile))
+                break;
+            try {
+                Thread.sleep(100);
+            } catch (Throwable t) {
+                if (evalException[0] != null) {
+                    evalException[0].addSuppressed(t);
+                } else {
+                    throw t;
+                }
+            }
+            if (evalException[0] != null) {
+                throw evalException[0];
+            }
+        }
 
         addToClasspath(compiler.getPath(outDir).resolve(jarName));