From 883a64e8eed0ea7db8653be9b476cac0a7f87dcc Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Tue, 22 Jun 2021 10:55:22 -0400 Subject: [PATCH] =?UTF-8?q?mac/arm64:=20recognize=20=E2=80=9CApple=20M1?= =?UTF-8?q?=E2=80=9D=C2=A0as=20a=20valid=20CPU=20vendor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DTK reported “Apple processor” in this spot, but shipping hardware now seems to use “Apple M1”. The DTK is no longer relevant, but for some degree of future-proofing, look for “Apple ” as prefix in the test. Test: snapshot_test SystemSnapshotMacTest.CPUVendor Bug: chromium:1222625 Change-Id: I6ead87ebe9aa078ef9a95e5bcc6a9e5ca8c3b55a Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2976787 Reviewed-by: Nico Weber Commit-Queue: Mark Mentovai --- BUILD.gn | 2 +- snapshot/BUILD.gn | 1 + snapshot/mac/system_snapshot_mac_test.cc | 3 ++- snapshot/snapshot_test.gyp | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index dfa7b1f9..666784af 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -152,7 +152,7 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { test("crashpad_snapshot_test") { deps = [ "snapshot:snapshot_test", - "test:googletest_main", + "test:googlemock_main", ] } diff --git a/snapshot/BUILD.gn b/snapshot/BUILD.gn index 70e4a310..2d613b6f 100644 --- a/snapshot/BUILD.gn +++ b/snapshot/BUILD.gn @@ -433,6 +433,7 @@ source_set("snapshot_test") { "../compat", "../minidump:format", "../test", + "../third_party/googletest:googlemock", "../third_party/googletest:googletest", "../third_party/mini_chromium:base", "../util", diff --git a/snapshot/mac/system_snapshot_mac_test.cc b/snapshot/mac/system_snapshot_mac_test.cc index bdbc2962..0cf1a7cf 100644 --- a/snapshot/mac/system_snapshot_mac_test.cc +++ b/snapshot/mac/system_snapshot_mac_test.cc @@ -19,6 +19,7 @@ #include #include "build/build_config.h" +#include "gmock/gmock.h" #include "gtest/gtest.h" #include "snapshot/mac/process_reader_mac.h" #include "test/errors.h" @@ -90,7 +91,7 @@ TEST_F(SystemSnapshotMacTest, CPUVendor) { FAIL() << "cpu_vendor " << cpu_vendor; } #elif defined(ARCH_CPU_ARM64) - EXPECT_EQ(cpu_vendor, "Apple processor"); + EXPECT_THAT(cpu_vendor, testing::StartsWith("Apple ")); #else #error port to your architecture #endif diff --git a/snapshot/snapshot_test.gyp b/snapshot/snapshot_test.gyp index a4d4d9e0..361a33a7 100644 --- a/snapshot/snapshot_test.gyp +++ b/snapshot/snapshot_test.gyp @@ -59,8 +59,9 @@ 'snapshot.gyp:crashpad_snapshot', '../client/client.gyp:crashpad_client', '../compat/compat.gyp:crashpad_compat', - '../test/test.gyp:crashpad_googletest_main', + '../test/test.gyp:crashpad_googlemock_main', '../test/test.gyp:crashpad_test', + '../third_party/googletest/googlemock.gyp:googlemock', '../third_party/googletest/googletest.gyp:googletest', '../third_party/mini_chromium/mini_chromium.gyp:base', '../util/util.gyp:crashpad_util',