mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 01:08:01 +08:00
ios: Disable annotations tests on older simulators on macOS 14.3
There appears to be a change in dyld in macOS 14.3 that iOS 17 accounts for, but older simulators do not. This causes the main binary to be listed twice when iterating modules, breaking some tests. Bug: crbug.com/328282286 Change-Id: I71909fbc13bee6de23b10ffd92a791067f8ea909 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5353754 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Justin Cohen <justincohen@chromium.org>
This commit is contained in:
parent
9c58b668ff
commit
c4d4a4d83e
@ -89,6 +89,18 @@ class InProcessIntermediateDumpHandlerTest : public testing::Test {
|
||||
const auto& path() const { return path_; }
|
||||
auto writer() const { return writer_.get(); }
|
||||
|
||||
#if TARGET_OS_SIMULATOR
|
||||
// macOS 14.0 is 23A344, macOS 13.6.5 is 22G621, so if the first two
|
||||
// characters in the kern.osversion are > 22, this build will reproduce the
|
||||
// simulator bug in crbug.com/328282286
|
||||
bool IsMacOSVersion143OrGreaterAndiOS16OrLess() {
|
||||
if (__builtin_available(iOS 17, *)) {
|
||||
return false;
|
||||
}
|
||||
return std::stoi(system_data_.Build().substr(0, 2)) > 22;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
std::unique_ptr<internal::IOSIntermediateDumpWriter> writer_;
|
||||
internal::IOSSystemDataCollector system_data_;
|
||||
@ -125,6 +137,15 @@ TEST_F(InProcessIntermediateDumpHandlerTest, TestSystem) {
|
||||
}
|
||||
|
||||
TEST_F(InProcessIntermediateDumpHandlerTest, TestAnnotations) {
|
||||
#if TARGET_OS_SIMULATOR
|
||||
// This test will fail on older (<iOS17 simulators) when running on macOS 14.3
|
||||
// or newer due to a bug in Simulator. crbug.com/328282286
|
||||
if (IsMacOSVersion143OrGreaterAndiOS16OrLess()) {
|
||||
// For TearDown.
|
||||
ASSERT_TRUE(LoggingRemoveFile(path()));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// This is “leaked” to crashpad_info.
|
||||
crashpad::SimpleStringDictionary* simple_annotations =
|
||||
new crashpad::SimpleStringDictionary();
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
#include <objc/runtime.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -24,6 +25,34 @@
|
||||
#include "util/mach/exception_types.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
|
||||
namespace {
|
||||
|
||||
#if TARGET_OS_SIMULATOR
|
||||
// macOS 14.0 is 23A344, macOS 13.6.5 is 22G621, so if the first two characters
|
||||
// in the kern.osversion are > 22, this build will reproduce the simulator bug
|
||||
// in crbug.com/328282286
|
||||
bool IsMacOSVersion143OrGreaterAndiOS16OrLess() {
|
||||
if (__builtin_available(iOS 17, *)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t buf_len;
|
||||
static constexpr char name[] = "kern.osversion";
|
||||
if (sysctlbyname(name, nullptr, &buf_len, nullptr, 0) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string build(buf_len - 1, '\0');
|
||||
if (sysctlbyname(name, &build[0], &buf_len, nullptr, 0) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return std::stoi(build.substr(0, 2)) > 22;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
@interface CPTestTestCase : XCTestCase {
|
||||
XCUIApplication* app_;
|
||||
CPTestSharedObject* rootObject_;
|
||||
@ -317,6 +346,14 @@
|
||||
#endif
|
||||
|
||||
- (void)testCrashWithAnnotations {
|
||||
#if TARGET_OS_SIMULATOR
|
||||
// This test will fail on older (<iOS17 simulators) when running on macOS 14.3
|
||||
// or newer due to a bug in Simulator. crbug.com/328282286
|
||||
if (IsMacOSVersion143OrGreaterAndiOS16OrLess()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
[rootObject_ crashWithAnnotations];
|
||||
[self verifyCrashReportException:EXC_SOFT_SIGNAL];
|
||||
NSNumber* report_exception;
|
||||
|
Loading…
x
Reference in New Issue
Block a user