summaryrefslogtreecommitdiffstats
path: root/harmony-tests/src/test/java
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-01-30 04:20:57 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-30 04:20:57 +0000
commitaf9afbef141c04143fd9172880d469d498f915b2 (patch)
treebee777ab13c2ef5c8ffcadddd42cb0819592a3d7 /harmony-tests/src/test/java
parent7f46df751bec45424c7c229183dd8e1d90ba0a00 (diff)
parent43bcec288e4b2e3f70903c6661c87a3edbec9e69 (diff)
downloadlibcore-af9afbef141c04143fd9172880d469d498f915b2.zip
libcore-af9afbef141c04143fd9172880d469d498f915b2.tar.gz
libcore-af9afbef141c04143fd9172880d469d498f915b2.tar.bz2
am 43bcec28: Merge "Remove flakiness from ProcessTest."
* commit '43bcec288e4b2e3f70903c6661c87a3edbec9e69': Remove flakiness from ProcessTest.
Diffstat (limited to 'harmony-tests/src/test/java')
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessTest.java9
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);