mac: Fix tests on 10.12.1

crashpad_snapshot_test MachOImageAnnotationsReader.CrashDyld was failing
on 10.12.1. In 10.12, dyld’s intentional crashes come through
abort_with_payload(). In 10.12.1, it appears that the task port sent
along with abort_with_payload() crashes is now a corpse port, which has
a different port name than the task port that it originated from.

https://openradar.appspot.com/29079442

TEST=crashpad_snapshot_test MachOImageAnnotationsReader.CrashDyld
BUG=crashpad:137

Change-Id: I43f89c0f595dd5614fc910fa1f19f21ddf0a7c4d
Reviewed-on: https://chromium-review.googlesource.com/407087
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Mark Mentovai 2016-11-02 20:06:39 -04:00
parent bb7d249d65
commit 375082098d

View File

@ -117,7 +117,18 @@ class TestMachOImageAnnotationsReader final
bool* destroy_complex_request) override {
*destroy_complex_request = true;
EXPECT_EQ(ChildTask(), task);
// In 10.12, dyld fatal errors as tested by test_type_ = kCrashDyld are via
// abort_with_payload(). In 10.12.1, the task port delivered in an exception
// message for this termination type is a corpse, even when the exception is
// EXC_CRASH and not EXC_CORPSE_NOTIFY. The corpse task port (here, |task|)
// is distinct from the process original task port (ChildTask()). This is
// filed as https://openradar.appspot.com/29079442.
//
// Instead of comparing task ports, compare PIDs.
pid_t task_pid;
kern_return_t kr = pid_for_task(task, &task_pid);
EXPECT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "pid_for_task");
EXPECT_EQ(ChildPID(), task_pid);
ProcessReader process_reader;
bool rv = process_reader.Initialize(task);