changeset 45717:83b617bc344a

8183019: Diagnostics for onExitTest Reviewed-by: clanger
author rriggs
date Fri, 30 Jun 2017 13:28:25 -0400
parents 4e40b6e09064
children ba97c984166b
files jdk/test/java/lang/ProcessHandle/OnExitTest.java
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java	Thu Jun 29 18:42:01 2017 -0700
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java	Fri Jun 30 13:28:25 2017 -0400
@@ -42,14 +42,7 @@
  * @test
  * @key intermittent
  * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          jdk.management
  * @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
  * @summary Functions of Process.onExit and ProcessHandle.onExit
  * @author Roger Riggs
@@ -251,10 +244,30 @@
                 }
                 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);
 
                 // Look for B to report that A has exited
                 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);
                 } while (!"waitpid".equals(split[1]));