Commit ccb389f8 authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Fix flaky ChildProcessTest.ChildHasCleanExit test on Android

This change makes sure we save the clean exit value if the connection to
the child process is lost.

Bug: 911716
Change-Id: I9e0ac28e4ed18a3852fa157a4ce1295552d79bc4
Reviewed-on: https://chromium-review.googlesource.com/c/1370644Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615968}
parent 3ce69a99
...@@ -22,8 +22,7 @@ MULTIPROCESS_TEST_MAIN(WaitingMain) { ...@@ -22,8 +22,7 @@ MULTIPROCESS_TEST_MAIN(WaitingMain) {
class ChildProcessTest : public MultiProcessTest {}; class ChildProcessTest : public MultiProcessTest {};
// TODO(http://crbug.com/911716): Test has been flaky. TEST_F(ChildProcessTest, ChildHasCleanExit) {
TEST_F(ChildProcessTest, DISABLED_ChildHasCleanExit) {
Process process = SpawnChild("BasicMain"); Process process = SpawnChild("BasicMain");
int exit_code = 0; int exit_code = 0;
EXPECT_TRUE(WaitForMultiprocessTestChildExit( EXPECT_TRUE(WaitForMultiprocessTestChildExit(
......
...@@ -43,6 +43,8 @@ public final class MultiprocessTestClientLauncher { ...@@ -43,6 +43,8 @@ public final class MultiprocessTestClientLauncher {
private static final SparseArray<MultiprocessTestClientLauncher> sPidToLauncher = private static final SparseArray<MultiprocessTestClientLauncher> sPidToLauncher =
new SparseArray<>(); new SparseArray<>();
private static final SparseArray<Boolean> sPidToCleanExit = new SparseArray<>();
private static final SparseArray<Integer> sPidToMainResult = new SparseArray<>(); private static final SparseArray<Integer> sPidToMainResult = new SparseArray<>();
private static final Object sLauncherHandlerInitLock = new Object(); private static final Object sLauncherHandlerInitLock = new Object();
...@@ -105,6 +107,7 @@ public final class MultiprocessTestClientLauncher { ...@@ -105,6 +107,7 @@ public final class MultiprocessTestClientLauncher {
assert isRunningOnLauncherThread(); assert isRunningOnLauncherThread();
assert sPidToLauncher.get(connection.getPid()) assert sPidToLauncher.get(connection.getPid())
== MultiprocessTestClientLauncher.this; == MultiprocessTestClientLauncher.this;
sPidToCleanExit.put(connection.getPid(), connection.hasCleanExit());
sPidToLauncher.remove(connection.getPid()); sPidToLauncher.remove(connection.getPid());
} }
}; };
...@@ -336,7 +339,7 @@ public final class MultiprocessTestClientLauncher { ...@@ -336,7 +339,7 @@ public final class MultiprocessTestClientLauncher {
MultiprocessTestClientLauncher launcher = sPidToLauncher.get(pid); MultiprocessTestClientLauncher launcher = sPidToLauncher.get(pid);
if (launcher == null) { if (launcher == null) {
return false; return sPidToCleanExit.get(pid, false);
} }
return launcher.mLauncher.getConnection().hasCleanExit(); return launcher.mLauncher.getConnection().hasCleanExit();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment