changeset 11867:35eb8ba7f6d8

8077402: JMXStartStopTest fails intermittently on slow hosts Reviewed-by: sla, dholmes
author jbachorik
date Mon, 27 Apr 2015 10:12:56 +0200
parents e3ac9940a2db
children f57957a657e3
files test/lib/testlibrary/jdk/testlibrary/ProcessTools.java test/sun/management/jmxremote/bootstrap/LocalManagementTest.java test/sun/management/jmxremote/startstop/JMXStartStopTest.java
diffstat 3 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Tue Apr 21 10:24:20 2015 +0200
+++ b/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Mon Apr 27 10:12:56 2015 +0200
@@ -227,7 +227,8 @@
      * <span>The default redirects of STDOUT and STDERR are started</span>
      * <p>
      * It is possible to wait for the process to get to a warmed-up state
-     * via {@linkplain Predicate} condition on the STDOUT
+     * via {@linkplain Predicate} condition on the STDOUT. The warm-up will
+     * wait indefinitely.
      * </p>
      * @param name The process name
      * @param processBuilder The process builder
--- a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Tue Apr 21 10:24:20 2015 +0200
+++ b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Mon Apr 27 10:12:56 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,9 +120,7 @@
                         return true;
                     }
                     return false;
-                },
-                5,
-                TimeUnit.SECONDS
+                }
             );
 
             System.out.println("Attaching test manager:");
@@ -142,9 +140,7 @@
             clientPrc = ProcessTools.startProcess(
                 "TestManager",
                 client,
-                (String line) -> line.startsWith("Starting TestManager for PID"),
-                10,
-                TimeUnit.SECONDS
+                (String line) -> line.startsWith("Starting TestManager for PID")
             );
 
             int clientExitCode = clientPrc.waitFor();
--- a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Tue Apr 21 10:24:20 2015 +0200
+++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Mon Apr 27 10:12:56 2015 +0200
@@ -311,9 +311,7 @@
                                 error.set(line.contains("BindException"));
 
                                 return ok || error.get();
-                            },
-                            5,
-                            TimeUnit.SECONDS
+                            }
                     );
                     if (error.get()) {
                         throw new BindException("Starting process failed due to " +
@@ -321,8 +319,10 @@
                     }
                     pid = p.getPid();
                 } catch (TimeoutException e) {
-                    p.destroy();
-                    p.waitFor();
+                    if (p != null) {
+                        p.destroy();
+                        p.waitFor();
+                    }
                     throw e;
                 }
             }