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 90f76d58..27179bb3 100644 --- a/client/ios_handler/in_process_intermediate_dump_handler_test.cc +++ b/client/ios_handler/in_process_intermediate_dump_handler_test.cc @@ -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 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 ( #include +#include #include @@ -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 (