changeset 11509:7fa7acbefe2a

8044772: TempDirTest.java still times out with -Xcomp Reviewed-by: coffeys
author avorobye
date Wed, 30 Mar 2016 13:04:15 +0300
parents 4548a4525cb9
children 8efe549f3c87
files test/com/sun/tools/attach/RunnerUtil.java test/com/sun/tools/attach/TempDirTest.java
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/tools/attach/RunnerUtil.java	Mon Mar 21 11:24:09 2016 +0100
+++ b/test/com/sun/tools/attach/RunnerUtil.java	Wed Mar 30 13:04:15 2016 +0300
@@ -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/test/com/sun/tools/attach/TempDirTest.java	Mon Mar 21 11:24:09 2016 +0100
+++ b/test/com/sun/tools/attach/TempDirTest.java	Wed Mar 30 13:04:15 2016 +0300
@@ -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 Application Shutdown RunnerUtil
- * @run main/timeout=10 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.cd /
  */
 
 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");
+
     }
 
     /**