OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Process_5.java] - Blame information for rev 781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// Create a long running process and verify that the exitValue is not
2
// immediately available.  Then destroy() it and verify that it
3
// terminates quickly with a non-zero exitValue.
4
public class Process_5
5
{
6
  public static void main(String[] args)
7
  {
8
    try
9
      {
10
        int c;
11
        long startTime = System.currentTimeMillis();
12
        Runtime r = Runtime.getRuntime();
13
        String[] a = { "sleep", "120" };
14
        Process p = r.exec(a);
15
 
16
        try
17
          {
18
            c = p.exitValue();
19
            System.out.println("bad 1");
20
            return;
21
          }
22
        catch (IllegalThreadStateException itse)
23
          {
24
            // Ignore as this is good here.
25
          }
26
 
27
        p.destroy();
28
 
29
        c = p.waitFor();
30
 
31
        long endTime = System.currentTimeMillis();
32
 
33
        if (endTime - startTime > 110000L)
34
          System.out.println("bad 2");
35
 
36
        System.out.println(c != 0 ? "ok" : "bad 3");
37
      }
38
    catch (Exception ex)
39
      {
40
        System.out.println(ex.toString());
41
      }
42
  }
43
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.