From 4c85c466b00cb762cefae816fbfab5c968aec25c Mon Sep 17 00:00:00 2001 From: Justin Cohen Date: Tue, 15 Mar 2022 20:10:09 -0400 Subject: [PATCH] ios: Fix test failure on M1 ARM64 machines. in_process_intermediate_dump_handler_test was mixing CPU architecture (x86_64 vs arm64) and iOS device type (iphoneos vs iphonesimulator). Bug: 1306589 Change-Id: Ie43a7f1916d69888e992320d999010071b2575b3 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3527034 Reviewed-by: Rohit Rao Commit-Queue: Justin Cohen --- .../in_process_intermediate_dump_handler_test.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/ios_handler/in_process_intermediate_dump_handler_test.cc b/client/ios_handler/in_process_intermediate_dump_handler_test.cc index 54af2c7f..e61a604d 100644 --- a/client/ios_handler/in_process_intermediate_dump_handler_test.cc +++ b/client/ios_handler/in_process_intermediate_dump_handler_test.cc @@ -104,12 +104,18 @@ TEST_F(InProcessIntermediateDumpHandlerTest, TestSystem) { EXPECT_STREQ(system->CPUVendor().c_str(), "GenuineIntel"); #elif defined(ARCH_CPU_ARM64) EXPECT_EQ(system->GetCPUArchitecture(), kCPUArchitectureARM64); - utsname uts; - ASSERT_EQ(uname(&uts), 0); - EXPECT_STREQ(system->MachineDescription().c_str(), uts.machine); #else #error Port to your CPU architecture #endif +#if TARGET_OS_SIMULATOR + EXPECT_EQ(system->MachineDescription().substr(0, 13), + std::string("iOS Simulator")); +#elif TARGET_OS_IPHONE + utsname uts; + ASSERT_EQ(uname(&uts), 0); + EXPECT_STREQ(system->MachineDescription().c_str(), uts.machine); +#endif + EXPECT_EQ(system->GetOperatingSystem(), SystemSnapshot::kOperatingSystemIOS); }