changeset 4916:afcc933a944e

7129125: TEST_BUG: java/lang/ProcessBuilder/Zombies.java failed on linux with "No such file" Reviewed-by: alanb
author michaelm
date Tue, 31 Jan 2012 14:26:04 +0000
parents 58c548d6b53e
children 42a19b1e0a7b
files test/java/lang/ProcessBuilder/Zombies.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/ProcessBuilder/Zombies.java	Tue Jan 31 09:19:02 2012 +0000
+++ b/test/java/lang/ProcessBuilder/Zombies.java	Tue Jan 31 14:26:04 2012 +0000
@@ -31,6 +31,12 @@
 import java.io.*;
 
 public class Zombies {
+
+    static final String os = System.getProperty("os.name");
+
+    static final String TrueCommand = os.startsWith("Mac OS")?
+        "/usr/bin/true" : "/bin/true";
+
     public static void main(String[] args) throws Throwable {
         if (! new File("/usr/bin/perl").canExecute() ||
             ! new File("/bin/ps").canExecute())
@@ -49,11 +55,11 @@
         } catch (IOException _) {/* OK */}
 
         try {
-            rt.exec("/usr/bin/true", null, new File("no-such-dir"));
+            rt.exec(TrueCommand, null, new File("no-such-dir"));
             throw new Error("expected IOException not thrown");
         } catch (IOException _) {/* OK */}
 
-        rt.exec("/usr/bin/true").waitFor();
+        rt.exec(TrueCommand).waitFor();
 
         // Count all the zombies that are children of this Java process
         final String[] zombieCounter = {