equal
deleted
inserted
replaced
37 * @test |
37 * @test |
38 * @bug 8033104 |
38 * @bug 8033104 |
39 * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set |
39 * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set |
40 * @library /lib/testlibrary |
40 * @library /lib/testlibrary |
41 * @run build jdk.testlibrary.* Application Shutdown RunnerUtil |
41 * @run build jdk.testlibrary.* Application Shutdown RunnerUtil |
42 * @run main TempDirTest |
42 * @run main/timeout=200 TempDirTest |
|
43 */ |
|
44 |
|
45 /* |
|
46 * This test runs with an extra long timeout since it takes a really long time with -Xcomp |
|
47 * when starting many processes. |
43 */ |
48 */ |
44 |
49 |
45 public class TempDirTest { |
50 public class TempDirTest { |
46 |
51 |
|
52 private static long startTime; |
|
53 |
47 public static void main(String args[]) throws Throwable { |
54 public static void main(String args[]) throws Throwable { |
|
55 |
|
56 startTime = System.currentTimeMillis(); |
48 |
57 |
49 Path clientTmpDir = Files.createTempDirectory("TempDirTest-client"); |
58 Path clientTmpDir = Files.createTempDirectory("TempDirTest-client"); |
50 clientTmpDir.toFile().deleteOnExit(); |
59 clientTmpDir.toFile().deleteOnExit(); |
51 Path targetTmpDir = Files.createTempDirectory("TempDirTest-target"); |
60 Path targetTmpDir = Files.createTempDirectory("TempDirTest-target"); |
52 targetTmpDir.toFile().deleteOnExit(); |
61 targetTmpDir.toFile().deleteOnExit(); |
74 System.out.print("### Running tests with overridden tmpdir for"); |
83 System.out.print("### Running tests with overridden tmpdir for"); |
75 System.out.print(" client: " + (clientTmpDir == null ? "no" : "yes")); |
84 System.out.print(" client: " + (clientTmpDir == null ? "no" : "yes")); |
76 System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes")); |
85 System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes")); |
77 System.out.println(" ###"); |
86 System.out.println(" ###"); |
78 |
87 |
|
88 long elapsedTime = (System.currentTimeMillis() - startTime) / 1000; |
|
89 System.out.println("Started after " + elapsedTime + "s"); |
|
90 |
79 final String pidFile = "TempDirTest.Application.pid-" + counter++; |
91 final String pidFile = "TempDirTest.Application.pid-" + counter++; |
80 ProcessThread processThread = null; |
92 ProcessThread processThread = null; |
81 RunnerUtil.ProcessInfo info = null; |
93 RunnerUtil.ProcessInfo info = null; |
82 try { |
94 try { |
83 String[] tmpDirArg = null; |
95 String[] tmpDirArg = null; |
93 throw t; |
105 throw t; |
94 } finally { |
106 } finally { |
95 // Make sure the Application process is stopped. |
107 // Make sure the Application process is stopped. |
96 RunnerUtil.stopApplication(info.shutdownPort, processThread); |
108 RunnerUtil.stopApplication(info.shutdownPort, processThread); |
97 } |
109 } |
|
110 |
|
111 elapsedTime = (System.currentTimeMillis() - startTime) / 1000; |
|
112 System.out.println("Completed after " + elapsedTime + "s"); |
|
113 |
98 } |
114 } |
99 |
115 |
100 /** |
116 /** |
101 * Runs the actual tests in nested class TestMain. |
117 * Runs the actual tests in nested class TestMain. |
102 * The reason for running the tests in a separate process |
118 * The reason for running the tests in a separate process |