From cb3b9dd352f838ece0eb0fd029085ce06d7cad8d Mon Sep 17 00:00:00 2001 From: avorobye Date: Wed, 30 Mar 2016 13:04:15 +0300 Subject: [PATCH] 8044772: TempDirTest.java still times out with -Xcomp Reviewed-by: coffeys --- test/com/sun/tools/attach/RunnerUtil.java | 7 +++++++ test/com/sun/tools/attach/TempDirTest.java | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/test/com/sun/tools/attach/RunnerUtil.java b/test/com/sun/tools/attach/RunnerUtil.java index 3555a299a..0fd278941 100644 --- a/test/com/sun/tools/attach/RunnerUtil.java +++ b/test/com/sun/tools/attach/RunnerUtil.java @@ -139,12 +139,19 @@ public class RunnerUtil { 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(); diff --git a/test/com/sun/tools/attach/TempDirTest.java b/test/com/sun/tools/attach/TempDirTest.java index e60f9ce46..520b6b679 100644 --- a/test/com/sun/tools/attach/TempDirTest.java +++ b/test/com/sun/tools/attach/TempDirTest.java @@ -39,13 +39,22 @@ import jdk.testlibrary.ProcessThread; * @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 @@ public class TempDirTest { 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 @@ public class TempDirTest { // Make sure the Application process is stopped. RunnerUtil.stopApplication(info.shutdownPort, processThread); } + + elapsedTime = (System.currentTimeMillis() - startTime) / 1000; + System.out.println("Completed after " + elapsedTime + "s"); + } /** -- GitLab