8150860: Mach 5 tier1 test started failing - jdk/jshell/ComputeFQNsTest.java (after 8131027/8150814)
authorjlahoda
Mon, 27 Jun 2016 09:43:12 +0200
changeset 39182 d4487b864f64
parent 39181 e2526131d705
child 39183 876b8b77beb3
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
langtools/test/jdk/jshell/ComputeFQNsTest.java
--- a/langtools/test/jdk/jshell/ComputeFQNsTest.java	Fri Jun 24 16:00:43 2016 -0700
+++ b/langtools/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));