changeset 25155:8b98011eac74

8044772: TempDirTest.java still times out with -Xcomp Reviewed-by: dholmes
author sla
date Mon, 23 Jun 2014 15:51:41 +0200
parents a4252397d312
children 354c86ad0bc8
files jdk/test/ProblemList.txt jdk/test/com/sun/tools/attach/RunnerUtil.java jdk/test/com/sun/tools/attach/TempDirTest.java
diffstat 3 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/ProblemList.txt	Mon Jun 23 10:57:22 2014 +0400
+++ b/jdk/test/ProblemList.txt	Mon Jun 23 15:51:41 2014 +0200
@@ -298,7 +298,4 @@
 # 8046355
 sun/tools/jstatd/TestJstatdExternalRegistry.java                generic-all
 
-# 8046352
-com/sun/tools/attach/TempDirTest.java                           generic-all
-
 ############################################################################
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java	Mon Jun 23 10:57:22 2014 +0400
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java	Mon Jun 23 15:51:41 2014 +0200
@@ -139,12 +139,19 @@
         String content = null;
 
         // Read file or wait for it to be created.
+        long startTime = System.currentTimeMillis();
+        long lastWarningTime = 0;
         while (true) {
             content = readFile(file);
             if (content != null && content.indexOf("done") >= 0) {
                 break;
             }
             Thread.sleep(100);
+            long elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
+            if (elapsedTime > lastWarningTime) {
+                lastWarningTime = elapsedTime;
+                System.out.println("Waited " + elapsedTime + " seconds for file.");
+            }
         }
 
         ProcessInfo info = new ProcessInfo();
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java	Mon Jun 23 10:57:22 2014 +0400
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java	Mon Jun 23 15:51:41 2014 +0200
@@ -39,13 +39,22 @@
  * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
  * @library /lib/testlibrary
  * @run build jdk.testlibrary.* Application Shutdown RunnerUtil
- * @run main TempDirTest
+ * @run main/timeout=200 TempDirTest
+ */
+
+/*
+ * This test runs with an extra long timeout since it takes a really long time with -Xcomp
+ * when starting many processes.
  */
 
 public class TempDirTest {
 
+    private static long startTime;
+
     public static void main(String args[]) throws Throwable {
 
+        startTime = System.currentTimeMillis();
+
         Path clientTmpDir = Files.createTempDirectory("TempDirTest-client");
         clientTmpDir.toFile().deleteOnExit();
         Path targetTmpDir = Files.createTempDirectory("TempDirTest-target");
@@ -76,6 +85,9 @@
         System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes"));
         System.out.println(" ###");
 
+        long elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
+        System.out.println("Started after " + elapsedTime + "s");
+
         final String pidFile = "TempDirTest.Application.pid-" + counter++;
         ProcessThread processThread = null;
         RunnerUtil.ProcessInfo info = null;
@@ -95,6 +107,10 @@
             // Make sure the Application process is stopped.
             RunnerUtil.stopApplication(info.shutdownPort, processThread);
         }
+
+        elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
+        System.out.println("Completed after " + elapsedTime + "s");
+
     }
 
     /**