Skip to content

Commit

Permalink
GWP-ASan: Work around WaitForMultiprocessTestChildExit bug
Browse files Browse the repository at this point in the history
WaitForMultiprocessTestChildExit on Android currently can't handle child
process crashes due to threading requirements for the Android-specific
implementation. Hack around it for now.

Bug: 973167
Change-Id: I7027dba463150802516ea525f4fc4e2cdfd8d18a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725335
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Auto-Submit: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682105}
  • Loading branch information
vlad902 authored and Commit Bot committed Jul 30, 2019
1 parent bf21a3e commit 5a45335
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion components/gwp_asan/crash_handler/crash_handler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,23 @@ class CrashHandlerTest : public base::MultiProcessTest,
base::Process process =
base::SpawnMultiProcessTestChild("CrashingProcess", cmd_line, options);

#if !defined(OS_ANDROID)
int exit_code = -1;
EXPECT_TRUE(WaitForMultiprocessTestChildExit(
process, TestTimeouts::action_max_timeout(), &exit_code));
EXPECT_NE(exit_code, kSuccess);

return (exit_code != kSuccess);
#else
// TODO(https://crbug.com/976063): Android's implementation of
// WaitForMultiprocessTestChildExit can't detect child process crashes, this
// can be fixed after minSdkVersion >= Q.
for (int i = 0; i < TestTimeouts::action_max_timeout().InSeconds(); i++) {
if (kill(process.Pid(), 0) && errno == ESRCH)
return true;
sleep(1);
}
return false;
#endif
}

// Given a directory with a single crashpad exception, read and parse the
Expand Down

0 comments on commit 5a45335

Please sign in to comment.