mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-15 16:44:36 +02:00
8183019: Diagnostics for onExitTest
Reviewed-by: clanger
This commit is contained in:
parent
c33dc7513c
commit
7b258a7561
1 changed files with 20 additions and 7 deletions
|
@ -42,14 +42,7 @@ import org.testng.TestNG;
|
||||||
* @test
|
* @test
|
||||||
* @key intermittent
|
* @key intermittent
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
|
||||||
* jdk.management
|
|
||||||
* @build jdk.test.lib.Utils
|
* @build jdk.test.lib.Utils
|
||||||
* jdk.test.lib.Asserts
|
|
||||||
* jdk.test.lib.JDKToolFinder
|
|
||||||
* jdk.test.lib.JDKToolLauncher
|
|
||||||
* jdk.test.lib.Platform
|
|
||||||
* jdk.test.lib.process.*
|
|
||||||
* @run testng OnExitTest
|
* @run testng OnExitTest
|
||||||
* @summary Functions of Process.onExit and ProcessHandle.onExit
|
* @summary Functions of Process.onExit and ProcessHandle.onExit
|
||||||
* @author Roger Riggs
|
* @author Roger Riggs
|
||||||
|
@ -251,10 +244,30 @@ public class OnExitTest extends ProcessUtil {
|
||||||
}
|
}
|
||||||
Assert.assertNull(line, "waitpid didn't wait");
|
Assert.assertNull(line, "waitpid didn't wait");
|
||||||
|
|
||||||
|
A.toHandle().onExit().thenAccept(p -> {
|
||||||
|
System.out.printf(" A.toHandle().onExit().A info: %s, now: %s%n",
|
||||||
|
p.info(), Instant.now());
|
||||||
|
});
|
||||||
|
|
||||||
|
A.onExit().thenAccept(p -> {
|
||||||
|
System.out.printf(" A.onExit().A info: %s, now: %s%n",
|
||||||
|
p.info(), Instant.now());
|
||||||
|
});
|
||||||
|
|
||||||
|
ProcessHandle.Info A_info = A.info();
|
||||||
|
|
||||||
A.sendAction("exit", 0L);
|
A.sendAction("exit", 0L);
|
||||||
|
|
||||||
// Look for B to report that A has exited
|
// Look for B to report that A has exited
|
||||||
do {
|
do {
|
||||||
|
Instant start = Instant.now();
|
||||||
|
while (blines.isEmpty() && A.isAlive()) {
|
||||||
|
A_info = A.info(); // Spin
|
||||||
|
}
|
||||||
|
Instant end = Instant.now();
|
||||||
|
System.out.printf(" a.isAlive: %s, a.info: %s, @%s%n", A.isAlive(), A.info(),
|
||||||
|
Duration.between(start, end));
|
||||||
|
|
||||||
split = getSplitLine(blines);
|
split = getSplitLine(blines);
|
||||||
} while (!"waitpid".equals(split[1]));
|
} while (!"waitpid".equals(split[1]));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue