diff options
author | David Daney <ddaney@avtrex.com> | 2007-04-09 17:40:20 +0000 |
---|---|---|
committer | David Daney <daney@gcc.gnu.org> | 2007-04-09 17:40:20 +0000 |
commit | 290b7f64b5e3bc1dad14911be133ba5f75fb600b (patch) | |
tree | b1c737c188f5f8453ba34c21ec12226fd1b5c954 /libjava/testsuite | |
parent | 22931aa4a943c3c937f4bf728917236ba27f975e (diff) | |
download | gcc-290b7f64b5e3bc1dad14911be133ba5f75fb600b.zip gcc-290b7f64b5e3bc1dad14911be133ba5f75fb600b.tar.gz gcc-290b7f64b5e3bc1dad14911be133ba5f75fb600b.tar.bz2 |
re PR libgcj/23758 (java::lang::ConcreteProcess::nativeSpawn unsafe)
PR libgcj/23758
* java/lang/natPosixProcess.cc (nativeSpawn): Move building of
environment before the fork.
* testsuite/libjava.lang/Process_7.java: New test.
* testsuite/libjava.lang/Process_7.out: Its expected results.
* testsuite/libjava.lang/Process_7.jar: Generated file.
From-SVN: r123676
Diffstat (limited to 'libjava/testsuite')
-rw-r--r-- | libjava/testsuite/libjava.lang/Process_7.jar | bin | 0 -> 1618 bytes | |||
-rw-r--r-- | libjava/testsuite/libjava.lang/Process_7.java | 45 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/Process_7.out | 1 |
3 files changed, 46 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/Process_7.jar b/libjava/testsuite/libjava.lang/Process_7.jar Binary files differnew file mode 100644 index 0000000..261578e --- /dev/null +++ b/libjava/testsuite/libjava.lang/Process_7.jar diff --git a/libjava/testsuite/libjava.lang/Process_7.java b/libjava/testsuite/libjava.lang/Process_7.java new file mode 100644 index 0000000..d6f654e --- /dev/null +++ b/libjava/testsuite/libjava.lang/Process_7.java @@ -0,0 +1,45 @@ +// Verify we can modify the environment. +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Map; + + + +public class Process_7 +{ + public static void main(String[] args) + { + try + { + ProcessBuilder pb = new ProcessBuilder("env"); + Map<String, String> e = pb.environment(); + e.clear(); + String v = "process7_value"; + String k = "PROCESS_7_KEY"; + e.put(k, v); + Process p = pb.start(); + InputStream is = p.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + boolean found = false; + + String result; + while ((result = br.readLine()) != null) + { + if (result.equals(k + '=' + v)) + found = true; + } + if (!found) + { + System.out.println("bad"); + return; + } + System.out.println("ok"); + } + catch (Exception ex) + { + System.out.println(ex.toString()); + } + } +} diff --git a/libjava/testsuite/libjava.lang/Process_7.out b/libjava/testsuite/libjava.lang/Process_7.out new file mode 100644 index 0000000..9766475 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Process_7.out @@ -0,0 +1 @@ +ok |