Starts compiling the crashpad_test_test target on iOS.

Brings up the subset of tests that pass on iOS without any modifications.
Additional tests will be added later as they are updated to pass on iOS.

Excludes non-compiling targets from the iOS build so that the default target
compiles cleanly.

Rolls mini_chromium to cdab1e6263ec7f3f61763efc1dac863f8dc07c80.
  2019-11-01 rohitrao Adds GN support for XCTest on iOS.
  2019-10-29 rohitrao Fixes for iOS compilation and running on iOS devices.

BUG=crashpad:31

Change-Id: I918f10fc941b37fa89b08ce87828dd4299437096
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1895905
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
This commit is contained in:
Rohit Rao 2019-11-04 21:19:33 -05:00 committed by Commit Bot
parent 6dadd492b8
commit bd1aa246ca
7 changed files with 119 additions and 26 deletions

View File

@ -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" ]
}
}
}

2
DEPS
View File

@ -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',

View File

@ -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",
]
}
}
}

View File

@ -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

View File

@ -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") {

View File

@ -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) && \

View File

@ -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)