diff options
author | Elliott Hughes <enh@google.com> | 2015-01-30 04:06:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-30 04:06:54 +0000 |
commit | 43bcec288e4b2e3f70903c6661c87a3edbec9e69 (patch) | |
tree | 8ff22e2509e0589373888d17ef81854521144949 /harmony-tests/src/test/java/org | |
parent | 1a11432d5e0bbe320f69603efb01730fb748305d (diff) | |
parent | 14f694589bb5944e7f3e6862600ba25b15a37d18 (diff) | |
download | libcore-43bcec288e4b2e3f70903c6661c87a3edbec9e69.zip libcore-43bcec288e4b2e3f70903c6661c87a3edbec9e69.tar.gz libcore-43bcec288e4b2e3f70903c6661c87a3edbec9e69.tar.bz2 |
Merge "Remove flakiness from ProcessTest."
Diffstat (limited to 'harmony-tests/src/test/java/org')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessTest.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessTest.java index 1a73719..c7a6e71 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessTest.java @@ -22,9 +22,10 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; +import libcore.io.Libcore; public class ProcessTest extends junit.framework.TestCase { - + // Test that failures to exec don't leave zombies lying around. public void test_55017() throws Exception { ArrayList<Process> children = new ArrayList<Process>(); for (int i = 0; i < 256; ++i) { @@ -36,13 +37,15 @@ public class ProcessTest extends junit.framework.TestCase { } assertEquals(0, children.size()); + String pid = Integer.toString(Libcore.os.getpid()); boolean onDevice = new File("/system/bin").exists(); - String[] psCommand = onDevice ? new String[] { "ps" } : new String[] { "ps", "s" }; + String[] psCommand = onDevice ? new String[] { "ps", "--ppid", pid } + : new String[] { "ps", "S", "--ppid", pid }; Process ps = Runtime.getRuntime().exec(psCommand, null, null); int zombieCount = 0; for (String line : readAndCloseStream(ps.getInputStream()).split("\n")) { if (line.contains(" Z ") || line.contains(" Z+ ")) { - ++zombieCount; + ++zombieCount; } } assertEquals(0, zombieCount); |