diff --git a/BUILD.gn b/BUILD.gn index d1a2b721..b1294cfb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -23,14 +23,18 @@ config("crashpad_config") { if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { test("crashpad_tests") { deps = [ - "client:client_test", - "handler:handler_test", - "minidump:minidump_test", - "snapshot:snapshot_test", "test:gmock_main", "test:test_test", - "util:util_test", ] + if (!crashpad_is_ios) { + deps += [ + "client:client_test", + "handler:handler_test", + "minidump:minidump_test", + "snapshot:snapshot_test", + "util:util_test", + ] + } } if (crashpad_is_in_fuchsia) { @@ -135,6 +139,9 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { "client:client_test", "test:gmock_main", ] + if (crashpad_is_ios) { + deps -= [ "client:client_test" ] + } } test("crashpad_handler_test") { @@ -142,6 +149,9 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { "handler:handler_test", "test:gtest_main", ] + if (crashpad_is_ios) { + deps -= [ "handler:handler_test" ] + } } test("crashpad_minidump_test") { @@ -149,6 +159,9 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { "minidump:minidump_test", "test:gtest_main", ] + if (crashpad_is_ios) { + deps -= [ "minidump:minidump_test" ] + } } test("crashpad_snapshot_test") { @@ -156,6 +169,9 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { "snapshot:snapshot_test", "test:gtest_main", ] + if (crashpad_is_ios) { + deps -= [ "snapshot:snapshot_test" ] + } } test("crashpad_test_test") { @@ -170,5 +186,8 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { "test:gmock_main", "util:util_test", ] + if (crashpad_is_ios) { + deps -= [ "util:util_test" ] + } } } diff --git a/DEPS b/DEPS index 90c103d0..4cf88253 100644 --- a/DEPS +++ b/DEPS @@ -33,7 +33,7 @@ deps = { '8048ece6c16c91acfe0d36d1d3cc0890ab6e945c', 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - '2298dbe9d0b3213720ac0e5418ad0013a19aeb5d', + 'cdab1e6263ec7f3f61763efc1dac863f8dc07c80', 'crashpad/third_party/libfuzzer/src': Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + 'fda403cf93ecb8792cb1d061564d89a6553ca020', diff --git a/build/BUILD.gn b/build/BUILD.gn index 0ef1127f..bc77bc81 100644 --- a/build/BUILD.gn +++ b/build/BUILD.gn @@ -45,7 +45,26 @@ config("crashpad_fuzzer_flags") { "-fsanitize=fuzzer", ] - ldflags = [ - "-fsanitize=address", - ] + ldflags = [ "-fsanitize=address" ] +} + +if (crashpad_is_ios) { + group("ios_enable_arc") { + if (crashpad_is_in_chromium) { + public_configs = [ "//build/config/compiler:enable_arc" ] + } else if (crashpad_is_standalone) { + public_configs = + [ "//third_party/mini_chromium/mini_chromium/build:ios_enable_arc" ] + } + } + + group("ios_xctest") { + if (crashpad_is_in_chromium) { + public_configs = [ "//build/config/ios:xctest_config" ] + } else if (crashpad_is_standalone) { + public_configs = [ + "//third_party/mini_chromium/mini_chromium/build/ios:xctest_config", + ] + } + } } diff --git a/build/crashpad_buildconfig.gni b/build/crashpad_buildconfig.gni index 7db56d60..e1ef71f2 100644 --- a/build/crashpad_buildconfig.gni +++ b/build/crashpad_buildconfig.gni @@ -23,11 +23,10 @@ declare_args() { } } -assert(crashpad_dependencies == "chromium" || - crashpad_dependencies == "fuchsia" || - crashpad_dependencies == "standalone" || - crashpad_dependencies == "external" || - crashpad_dependencies == "dart") +assert( + crashpad_dependencies == "chromium" || crashpad_dependencies == "fuchsia" || + crashpad_dependencies == "standalone" || + crashpad_dependencies == "external" || crashpad_dependencies == "dart") crashpad_is_in_chromium = crashpad_dependencies == "chromium" crashpad_is_in_fuchsia = crashpad_dependencies == "fuchsia" @@ -37,6 +36,7 @@ crashpad_is_standalone = crashpad_dependencies == "standalone" if (crashpad_is_in_chromium) { crashpad_is_mac = is_mac + crashpad_is_ios = is_ios crashpad_is_win = is_win crashpad_is_linux = is_linux crashpad_is_android = is_android @@ -57,6 +57,7 @@ if (crashpad_is_in_chromium) { import("../third_party/mini_chromium/mini_chromium/build/platform.gni") } crashpad_is_mac = mini_chromium_is_mac + crashpad_is_ios = mini_chromium_is_ios crashpad_is_win = mini_chromium_is_win crashpad_is_linux = mini_chromium_is_linux crashpad_is_android = mini_chromium_is_android diff --git a/test/BUILD.gn b/test/BUILD.gn index 7f448632..5159744b 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -43,13 +43,36 @@ static_library("test") { "test_paths.h", ] + if (crashpad_is_ios) { + sources -= [ + "errors.cc", + "errors.h", + "file.cc", + "file.h", + "filesystem.cc", + "filesystem.h", + "multiprocess.h", + "multiprocess_exec.cc", + "multiprocess_exec.h", + "process_type.cc", + "process_type.h", + "scoped_guarded_page.h", + "scoped_module_handle.cc", + "scoped_module_handle.h", + "scoped_temp_dir.cc", + "scoped_temp_dir.h", + "test_paths.cc", + "test_paths.h", + ] + } + if (crashpad_is_posix || crashpad_is_fuchsia) { sources += [ "scoped_guarded_page_posix.cc", "scoped_temp_dir_posix.cc", ] - if (!crashpad_is_fuchsia) { + if (!crashpad_is_fuchsia && !crashpad_is_ios) { sources += [ "multiprocess_exec_posix.cc", "multiprocess_posix.cc", @@ -118,6 +141,13 @@ static_library("test") { "../util", ] + if (crashpad_is_ios) { + deps -= [ + "../compat", + "../util", + ] + } + if (crashpad_is_mac) { libs = [ "bsm" ] deps += [ @@ -152,9 +182,18 @@ source_set("test_test") { "test_paths_test.cc", ] + if (crashpad_is_ios) { + sources -= [ + "multiprocess_exec_test.cc", + "scoped_guarded_page_test.cc", + "scoped_temp_dir_test.cc", + "test_paths_test.cc", + ] + } + # TODO(crbug.com/812974): Remove !crashpad_is_fuchsia when Fuchsia is no # longer treated as a posix platform. - if (crashpad_is_posix && !crashpad_is_fuchsia) { + if (crashpad_is_posix && !crashpad_is_fuchsia && !crashpad_is_ios) { sources += [ "multiprocess_posix_test.cc" ] } @@ -181,16 +220,27 @@ source_set("test_test") { data_deps = [ ":crashpad_test_test_multiprocess_exec_test_child", ] + + if (crashpad_is_ios) { + deps -= [ + "../compat", + "../util", + ] + + data_deps -= [ ":crashpad_test_test_multiprocess_exec_test_child" ] + } } -crashpad_executable("crashpad_test_test_multiprocess_exec_test_child") { - sources = [ - "multiprocess_exec_test_child.cc", - ] +if (!crashpad_is_ios) { + crashpad_executable("crashpad_test_test_multiprocess_exec_test_child") { + sources = [ + "multiprocess_exec_test_child.cc", + ] - deps = [ - "../third_party/mini_chromium:base", - ] + deps = [ + "../third_party/mini_chromium:base", + ] + } } static_library("gmock_main") { diff --git a/test/gtest_death.h b/test/gtest_death.h index 69f6361e..f205a2f1 100644 --- a/test/gtest_death.h +++ b/test/gtest_death.h @@ -25,7 +25,7 @@ //! \file -#if defined(OS_MACOSX) || DOXYGEN +#if (defined(OS_MACOSX) && !defined(OS_IOS)) || DOXYGEN //! \brief Wraps the gtest `ASSERT_DEATH_IF_SUPPORTED()` macro to make //! assertions about death caused by crashes. @@ -73,14 +73,14 @@ regex); \ } while (false) -#else // OS_MACOSX +#else // OS_MACOSX && !OS_IOS #define ASSERT_DEATH_CRASH(statement, regex) \ ASSERT_DEATH_IF_SUPPORTED(statement, regex) #define EXPECT_DEATH_CRASH(statement, regex) \ EXPECT_DEATH_IF_SUPPORTED(statement, regex) -#endif // OS_MACOSX +#endif // OS_MACOSX && !OS_IOS #if !(!defined(MINI_CHROMIUM_BASE_LOGGING_H_) && \ defined(OFFICIAL_BUILD) && \ diff --git a/test/gtest_main.cc b/test/gtest_main.cc index 5a54691f..e65f9214 100644 --- a/test/gtest_main.cc +++ b/test/gtest_main.cc @@ -33,6 +33,7 @@ namespace { +#if !defined(OS_IOS) bool GetChildTestFunctionName(std::string* child_func_name) { constexpr size_t arg_length = sizeof(crashpad::test::internal::kChildTestFunction) - 1; @@ -45,17 +46,20 @@ bool GetChildTestFunctionName(std::string* child_func_name) { } return false; } +#endif // !OS_IOS } // namespace int main(int argc, char* argv[]) { crashpad::test::InitializeMainArguments(argc, argv); +#if !defined(OS_IOS) std::string child_func_name; if (GetChildTestFunctionName(&child_func_name)) { return crashpad::test::internal::CheckedInvokeMultiprocessChild( child_func_name); } +#endif // !OS_IOS #if defined(CRASHPAD_IS_IN_CHROMIUM)