Process_1.java: New test.
2004-08-03 David Daney <ddaney@avtrex.com> * testsuite/libjava.lang/Process_1.java: New test. * testsuite/libjava.lang/Process_2.java: New test. * testsuite/libjava.lang/Process_3.java: New test. * testsuite/libjava.lang/Process_4.java: New test. * testsuite/libjava.lang/Process_5.java: New test. * testsuite/libjava.lang/Process_6.java: New test. * testsuite/libjava.lang/Process_1.out: Expected result. * testsuite/libjava.lang/Process_2.out: Expected result. * testsuite/libjava.lang/Process_3.out: Expected result. * testsuite/libjava.lang/Process_4.out: Expected result. * testsuite/libjava.lang/Process_5.out: Expected result. * testsuite/libjava.lang/Process_6.out: Expected result. From-SVN: r85881
This commit is contained in:
parent
c58f29001d
commit
faa03cf1b4
13 changed files with 286 additions and 0 deletions
43
libjava/testsuite/libjava.lang/Process_5.java
Normal file
43
libjava/testsuite/libjava.lang/Process_5.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Create a long running process and verify that the exitValue is not
|
||||
// immediately available. Then destroy() it and verify that it
|
||||
// terminates quickly with a non-zero exitValue.
|
||||
public class Process_5
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
int c;
|
||||
long startTime = System.currentTimeMillis();
|
||||
Runtime r = Runtime.getRuntime();
|
||||
String[] a = { "sleep", "120" };
|
||||
Process p = r.exec(a);
|
||||
|
||||
try
|
||||
{
|
||||
c = p.exitValue();
|
||||
System.out.println("bad 1");
|
||||
return;
|
||||
}
|
||||
catch (IllegalThreadStateException itse)
|
||||
{
|
||||
// Ignore as this is good here.
|
||||
}
|
||||
|
||||
p.destroy();
|
||||
|
||||
c = p.waitFor();
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
|
||||
if (endTime - startTime > 110000L)
|
||||
System.out.println("bad 2");
|
||||
|
||||
System.out.println(c != 0 ? "ok" : "bad 3");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println(ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue