提交 687bbb12 编写于 作者: R rriggs

8043477: java/lang/ProcessBuilder/Basic.java failed with:...

8043477: java/lang/ProcessBuilder/Basic.java failed with: java.lang.AssertionError: Some tests failed
Reviewed-by: martin
上级 5e830977
...@@ -2246,9 +2246,10 @@ public class Basic { ...@@ -2246,9 +2246,10 @@ public class Basic {
fail("Test failed: Process exited prematurely"); fail("Test failed: Process exited prematurely");
} }
long end = System.nanoTime(); long end = System.nanoTime();
// give waitFor(timeout) a wide berth (200ms) // give waitFor(timeout) a wide berth (2s)
// Old AIX machines my need a little longer. System.out.printf(" waitFor process: delta: %d%n",(end - start) );
if ((end - start) > 200000000L * (AIX.is() ? 2 : 1))
if ((end - start) > TimeUnit.SECONDS.toNanos(2))
fail("Test failed: waitFor took too long (" + (end - start) + "ns)"); fail("Test failed: waitFor took too long (" + (end - start) + "ns)");
p.destroy(); p.destroy();
...@@ -2272,19 +2273,23 @@ public class Basic { ...@@ -2272,19 +2273,23 @@ public class Basic {
final Process p = new ProcessBuilder(childArgs).start(); final Process p = new ProcessBuilder(childArgs).start();
long start = System.nanoTime(); long start = System.nanoTime();
p.waitFor(1000, TimeUnit.MILLISECONDS); p.waitFor(10, TimeUnit.MILLISECONDS);
long end = System.nanoTime(); long end = System.nanoTime();
if ((end - start) < 500000000) if ((end - start) < TimeUnit.MILLISECONDS.toNanos(10))
fail("Test failed: waitFor didn't take long enough (" + (end - start) + "ns)"); fail("Test failed: waitFor didn't take long enough (" + (end - start) + "ns)");
p.destroy(); p.destroy();
start = System.nanoTime(); start = System.nanoTime();
p.waitFor(1000, TimeUnit.MILLISECONDS); p.waitFor(8, TimeUnit.SECONDS);
end = System.nanoTime(); end = System.nanoTime();
if ((end - start) > 900000000)
fail("Test failed: waitFor took too long on a dead process. (" + (end - start) + "ns)"); int exitValue = p.exitValue();
if ((end - start) > TimeUnit.SECONDS.toNanos(7))
fail("Test failed: waitFor took too long on a dead process. (" + (end - start) + "ns)"
+ ", exitValue: " + exitValue);
} catch (Throwable t) { unexpected(t); } } catch (Throwable t) { unexpected(t); }
//---------------------------------------------------------------- //----------------------------------------------------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册