Index: third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc |
diff --git a/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc b/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc |
index 8525c14e2a2b35b935eff0e2451952d98b22b8ad..f9ff7d19d5c99b633d574fc8c2451e2a35aa5065 100644 |
--- a/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc |
+++ b/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc |
@@ -39,7 +39,7 @@ namespace { |
std::string proctype_string; \ |
ASSERT_TRUE(process_reader.Memory()->ReadCString(proctype_view.field, \ |
&proctype_string)); \ |
- EXPECT_EQ(self_view->field, proctype_string); \ |
+ EXPECT_EQ(proctype_string, self_view->field); \ |
} \ |
} while (false) |
@@ -66,7 +66,7 @@ TEST(ProcessTypes, DyldImagesSelf) { |
} |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 |
if (self_image_infos->version >= 9) { |
- EXPECT_EQ(self_image_infos, self_image_infos->dyldAllImageInfosAddress); |
+ EXPECT_EQ(self_image_infos->dyldAllImageInfosAddress, self_image_infos); |
} |
#endif |
@@ -78,10 +78,10 @@ TEST(ProcessTypes, DyldImagesSelf) { |
TASK_DYLD_INFO, |
reinterpret_cast<task_info_t>(&dyld_info), |
&count); |
- ASSERT_EQ(KERN_SUCCESS, kr); |
+ ASSERT_EQ(kr, KERN_SUCCESS); |
- EXPECT_EQ(reinterpret_cast<mach_vm_address_t>(self_image_infos), |
- dyld_info.all_image_info_addr); |
+ EXPECT_EQ(dyld_info.all_image_info_addr, |
+ reinterpret_cast<mach_vm_address_t>(self_image_infos)); |
EXPECT_GT(dyld_info.all_image_info_size, 1u); |
// This field is only present in the OS X 10.7 SDK (at build time) and kernel |
@@ -89,9 +89,9 @@ TEST(ProcessTypes, DyldImagesSelf) { |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 |
if (MacOSXMinorVersion() >= 7) { |
#if !defined(ARCH_CPU_64_BITS) |
- EXPECT_EQ(TASK_DYLD_ALL_IMAGE_INFO_32, dyld_info.all_image_info_format); |
+ EXPECT_EQ(dyld_info.all_image_info_format, TASK_DYLD_ALL_IMAGE_INFO_32); |
#else |
- EXPECT_EQ(TASK_DYLD_ALL_IMAGE_INFO_64, dyld_info.all_image_info_format); |
+ EXPECT_EQ(dyld_info.all_image_info_format, TASK_DYLD_ALL_IMAGE_INFO_64); |
#endif |
} |
#endif |
@@ -113,9 +113,9 @@ TEST(ProcessTypes, DyldImagesSelf) { |
// Make sure that the size of the structure as declared in the SDK matches the |
// size expected for the version of the structure that the SDK describes. |
- EXPECT_EQ(sizeof(dyld_all_image_infos), |
- process_types::dyld_all_image_infos::ExpectedSizeForVersion( |
- &process_reader, kDyldAllImageInfosVersionInSDK)); |
+ EXPECT_EQ(process_types::dyld_all_image_infos::ExpectedSizeForVersion( |
+ &process_reader, kDyldAllImageInfosVersionInSDK), |
+ sizeof(dyld_all_image_infos)); |
// Make sure that the computed sizes of various versions of this structure are |
// correct at different bitnessses. |
@@ -143,50 +143,50 @@ TEST(ProcessTypes, DyldImagesSelf) { |
uint32_t version = kVersionsAndSizes[index].version; |
SCOPED_TRACE(base::StringPrintf("index %zu, version %u", index, version)); |
- EXPECT_EQ(kVersionsAndSizes[index].size_32, |
- process_types::internal::dyld_all_image_infos< |
- process_types::internal::Traits32>:: |
- ExpectedSizeForVersion(version)); |
- EXPECT_EQ(kVersionsAndSizes[index].size_64, |
- process_types::internal::dyld_all_image_infos< |
- process_types::internal::Traits64>:: |
- ExpectedSizeForVersion(version)); |
+ EXPECT_EQ( |
+ process_types::internal::dyld_all_image_infos< |
+ process_types::internal::Traits32>::ExpectedSizeForVersion(version), |
+ kVersionsAndSizes[index].size_32); |
+ EXPECT_EQ( |
+ process_types::internal::dyld_all_image_infos< |
+ process_types::internal::Traits64>::ExpectedSizeForVersion(version), |
+ kVersionsAndSizes[index].size_64); |
} |
process_types::dyld_all_image_infos proctype_image_infos; |
ASSERT_TRUE(proctype_image_infos.Read(&process_reader, |
dyld_info.all_image_info_addr)); |
- ASSERT_EQ(self_image_infos->version, proctype_image_infos.version); |
+ ASSERT_EQ(proctype_image_infos.version, self_image_infos->version); |
if (proctype_image_infos.version >= 1) { |
- EXPECT_EQ(self_image_infos->infoArrayCount, |
- proctype_image_infos.infoArrayCount); |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->infoArray), |
- proctype_image_infos.infoArray); |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->notification), |
- proctype_image_infos.notification); |
- EXPECT_EQ(self_image_infos->processDetachedFromSharedRegion, |
- proctype_image_infos.processDetachedFromSharedRegion); |
+ EXPECT_EQ(proctype_image_infos.infoArrayCount, |
+ self_image_infos->infoArrayCount); |
+ EXPECT_EQ(proctype_image_infos.infoArray, |
+ reinterpret_cast<uint64_t>(self_image_infos->infoArray)); |
+ EXPECT_EQ(proctype_image_infos.notification, |
+ reinterpret_cast<uint64_t>(self_image_infos->notification)); |
+ EXPECT_EQ(proctype_image_infos.processDetachedFromSharedRegion, |
+ self_image_infos->processDetachedFromSharedRegion); |
} |
if (proctype_image_infos.version >= 2) { |
- EXPECT_EQ(self_image_infos->libSystemInitialized, |
- proctype_image_infos.libSystemInitialized); |
+ EXPECT_EQ(proctype_image_infos.libSystemInitialized, |
+ self_image_infos->libSystemInitialized); |
EXPECT_EQ( |
- reinterpret_cast<uint64_t>(self_image_infos->dyldImageLoadAddress), |
- proctype_image_infos.dyldImageLoadAddress); |
+ proctype_image_infos.dyldImageLoadAddress, |
+ reinterpret_cast<uint64_t>(self_image_infos->dyldImageLoadAddress)); |
} |
if (proctype_image_infos.version >= 3) { |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->jitInfo), |
- proctype_image_infos.jitInfo); |
+ EXPECT_EQ(proctype_image_infos.jitInfo, |
+ reinterpret_cast<uint64_t>(self_image_infos->jitInfo)); |
} |
if (proctype_image_infos.version >= 5) { |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->dyldVersion), |
- proctype_image_infos.dyldVersion); |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->errorMessage), |
- proctype_image_infos.errorMessage); |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->terminationFlags), |
- proctype_image_infos.terminationFlags); |
+ EXPECT_EQ(proctype_image_infos.dyldVersion, |
+ reinterpret_cast<uint64_t>(self_image_infos->dyldVersion)); |
+ EXPECT_EQ(proctype_image_infos.errorMessage, |
+ reinterpret_cast<uint64_t>(self_image_infos->errorMessage)); |
+ EXPECT_EQ(proctype_image_infos.terminationFlags, |
+ implicit_cast<uint64_t>(self_image_infos->terminationFlags)); |
TEST_STRING( |
process_reader, self_image_infos, proctype_image_infos, dyldVersion); |
@@ -195,38 +195,38 @@ TEST(ProcessTypes, DyldImagesSelf) { |
} |
if (proctype_image_infos.version >= 6) { |
EXPECT_EQ( |
- reinterpret_cast<uint64_t>(self_image_infos->coreSymbolicationShmPage), |
- proctype_image_infos.coreSymbolicationShmPage); |
+ proctype_image_infos.coreSymbolicationShmPage, |
+ reinterpret_cast<uint64_t>(self_image_infos->coreSymbolicationShmPage)); |
} |
if (proctype_image_infos.version >= 7) { |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->systemOrderFlag), |
- proctype_image_infos.systemOrderFlag); |
+ EXPECT_EQ(proctype_image_infos.systemOrderFlag, |
+ implicit_cast<uint64_t>(self_image_infos->systemOrderFlag)); |
} |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 |
if (proctype_image_infos.version >= 8) { |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->uuidArrayCount), |
- proctype_image_infos.uuidArrayCount); |
+ EXPECT_EQ(proctype_image_infos.uuidArrayCount, |
+ implicit_cast<uint64_t>(self_image_infos->uuidArrayCount)); |
} |
if (proctype_image_infos.version >= 9) { |
EXPECT_EQ( |
- reinterpret_cast<uint64_t>(self_image_infos->dyldAllImageInfosAddress), |
- proctype_image_infos.dyldAllImageInfosAddress); |
+ proctype_image_infos.dyldAllImageInfosAddress, |
+ reinterpret_cast<uint64_t>(self_image_infos->dyldAllImageInfosAddress)); |
} |
if (proctype_image_infos.version >= 10) { |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->initialImageCount), |
- proctype_image_infos.initialImageCount); |
+ EXPECT_EQ(proctype_image_infos.initialImageCount, |
+ implicit_cast<uint64_t>(self_image_infos->initialImageCount)); |
} |
if (proctype_image_infos.version >= 11) { |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->errorKind), |
- proctype_image_infos.errorKind); |
+ EXPECT_EQ(proctype_image_infos.errorKind, |
+ implicit_cast<uint64_t>(self_image_infos->errorKind)); |
EXPECT_EQ( |
- reinterpret_cast<uint64_t>(self_image_infos->errorClientOfDylibPath), |
- proctype_image_infos.errorClientOfDylibPath); |
+ proctype_image_infos.errorClientOfDylibPath, |
+ reinterpret_cast<uint64_t>(self_image_infos->errorClientOfDylibPath)); |
EXPECT_EQ( |
- reinterpret_cast<uint64_t>(self_image_infos->errorTargetDylibPath), |
- proctype_image_infos.errorTargetDylibPath); |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->errorSymbol), |
- proctype_image_infos.errorSymbol); |
+ proctype_image_infos.errorTargetDylibPath, |
+ reinterpret_cast<uint64_t>(self_image_infos->errorTargetDylibPath)); |
+ EXPECT_EQ(proctype_image_infos.errorSymbol, |
+ reinterpret_cast<uint64_t>(self_image_infos->errorSymbol)); |
TEST_STRING(process_reader, |
self_image_infos, |
@@ -240,31 +240,32 @@ TEST(ProcessTypes, DyldImagesSelf) { |
process_reader, self_image_infos, proctype_image_infos, errorSymbol); |
} |
if (proctype_image_infos.version >= 12) { |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->sharedCacheSlide), |
- proctype_image_infos.sharedCacheSlide); |
+ EXPECT_EQ(proctype_image_infos.sharedCacheSlide, |
+ implicit_cast<uint64_t>(self_image_infos->sharedCacheSlide)); |
} |
#endif |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 |
if (proctype_image_infos.version >= 13) { |
- EXPECT_EQ(0, |
- memcmp(self_image_infos->sharedCacheUUID, |
+ EXPECT_EQ(memcmp(self_image_infos->sharedCacheUUID, |
proctype_image_infos.sharedCacheUUID, |
- sizeof(self_image_infos->sharedCacheUUID))); |
+ sizeof(self_image_infos->sharedCacheUUID)), |
+ 0); |
} |
#endif |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12 |
if (proctype_image_infos.version >= 15) { |
- EXPECT_EQ(self_image_infos->infoArrayChangeTimestamp, |
- proctype_image_infos.infoArrayChangeTimestamp); |
- EXPECT_EQ(self_image_infos->sharedCacheBaseAddress, |
- proctype_image_infos.sharedCacheBaseAddress); |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->dyldPath), |
- proctype_image_infos.dyldPath); |
+ EXPECT_EQ(proctype_image_infos.infoArrayChangeTimestamp, |
+ self_image_infos->infoArrayChangeTimestamp); |
+ EXPECT_EQ(proctype_image_infos.sharedCacheBaseAddress, |
+ self_image_infos->sharedCacheBaseAddress); |
+ EXPECT_EQ(proctype_image_infos.dyldPath, |
+ reinterpret_cast<uint64_t>(self_image_infos->dyldPath)); |
for (size_t index = 0; |
index < arraysize(self_image_infos->notifyPorts); |
++index) { |
- EXPECT_EQ(self_image_infos->notifyPorts[index], |
- proctype_image_infos.notifyPorts[index]) << "index " << index; |
+ EXPECT_EQ(proctype_image_infos.notifyPorts[index], |
+ self_image_infos->notifyPorts[index]) |
+ << "index " << index; |
} |
TEST_STRING( |
@@ -283,16 +284,16 @@ TEST(ProcessTypes, DyldImagesSelf) { |
for (size_t index = 0; |
index < arraysize(proctype_image_infos.reserved); |
++index) { |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->reserved[index]), |
- proctype_image_infos.reserved[index]) |
+ EXPECT_EQ(proctype_image_infos.reserved[index], |
+ implicit_cast<uint64_t>(self_image_infos->reserved[index])) |
<< "index " << index; |
} |
#if defined(ARCH_CPU_64_BITS) |
- EXPECT_EQ(self_image_infos->reserved[4], proctype_image_infos.reserved_4); |
- EXPECT_EQ(self_image_infos->reserved[5], proctype_image_infos.reserved_5); |
- EXPECT_EQ(self_image_infos->reserved[6], proctype_image_infos.reserved_6); |
- EXPECT_EQ(self_image_infos->reserved[7], proctype_image_infos.reserved_7); |
- EXPECT_EQ(self_image_infos->reserved[8], proctype_image_infos.reserved_8); |
+ EXPECT_EQ(proctype_image_infos.reserved_4, self_image_infos->reserved[4]); |
+ EXPECT_EQ(proctype_image_infos.reserved_5, self_image_infos->reserved[5]); |
+ EXPECT_EQ(proctype_image_infos.reserved_6, self_image_infos->reserved[6]); |
+ EXPECT_EQ(proctype_image_infos.reserved_7, self_image_infos->reserved[7]); |
+ EXPECT_EQ(proctype_image_infos.reserved_8, self_image_infos->reserved[8]); |
#endif |
} |
#endif |
@@ -314,14 +315,14 @@ TEST(ProcessTypes, DyldImagesSelf) { |
const process_types::dyld_image_info& proctype_image_info = |
proctype_image_info_vector[index]; |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_info->imageLoadAddress), |
- proctype_image_info.imageLoadAddress) |
+ EXPECT_EQ(proctype_image_info.imageLoadAddress, |
+ reinterpret_cast<uint64_t>(self_image_info->imageLoadAddress)) |
<< "index " << index; |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_info->imageFilePath), |
- proctype_image_info.imageFilePath) |
+ EXPECT_EQ(proctype_image_info.imageFilePath, |
+ reinterpret_cast<uint64_t>(self_image_info->imageFilePath)) |
<< "index " << index; |
- EXPECT_EQ(implicit_cast<uint64_t>(self_image_info->imageFileModDate), |
- proctype_image_info.imageFileModDate) |
+ EXPECT_EQ(proctype_image_info.imageFileModDate, |
+ implicit_cast<uint64_t>(self_image_info->imageFileModDate)) |
<< "index " << index; |
TEST_STRING( |
@@ -347,13 +348,13 @@ TEST(ProcessTypes, DyldImagesSelf) { |
const process_types::dyld_uuid_info& proctype_uuid_info = |
proctype_uuid_info_vector[index]; |
- EXPECT_EQ(reinterpret_cast<uint64_t>(self_uuid_info->imageLoadAddress), |
- proctype_uuid_info.imageLoadAddress) |
+ EXPECT_EQ(proctype_uuid_info.imageLoadAddress, |
+ reinterpret_cast<uint64_t>(self_uuid_info->imageLoadAddress)) |
<< "index " << index; |
- EXPECT_EQ(0, |
- memcmp(self_uuid_info->imageUUID, |
+ EXPECT_EQ(memcmp(self_uuid_info->imageUUID, |
proctype_uuid_info.imageUUID, |
- sizeof(self_uuid_info->imageUUID))) |
+ sizeof(self_uuid_info->imageUUID)), |
+ 0) |
<< "index " << index; |
} |
} |