mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-27 15:32:10 +08:00
ios: Enable (and test!) more of util and test
This builds some code in the util and test libraries on iOS that was previously excluded. It also enables tests for this code, and other tests that it was possible to enable either previously or as a result of this change. Previously, crashpad_util_test ran 178 tests from 46 test suites, and crashpad_test_test ran 2 tests from 2 test suites. Now, crashpad_util_test runs 284 tests from 62 test suites, and crashpad_test_test runs 6 tests from 4 test suites. The related .gn files also suffered through a slight cleanup. Bug: crashpad:31 Change-Id: I84cdda5631f0ea4888ada902a8462776ac46fd2a Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154526 Reviewed-by: Justin Cohen <justincohen@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
ea4af71c2a
commit
122a400d7b
@ -43,29 +43,6 @@ static_library("test") {
|
|||||||
"test_paths.h",
|
"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) {
|
if (crashpad_is_posix || crashpad_is_fuchsia) {
|
||||||
sources += [
|
sources += [
|
||||||
"scoped_guarded_page_posix.cc",
|
"scoped_guarded_page_posix.cc",
|
||||||
@ -93,6 +70,14 @@ static_library("test") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
sources -= [
|
||||||
|
"multiprocess.h",
|
||||||
|
"multiprocess_exec.cc",
|
||||||
|
"multiprocess_exec.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if (crashpad_is_linux || crashpad_is_android) {
|
if (crashpad_is_linux || crashpad_is_android) {
|
||||||
set_sources_assignment_filter([])
|
set_sources_assignment_filter([])
|
||||||
sources += [
|
sources += [
|
||||||
@ -139,13 +124,6 @@ static_library("test") {
|
|||||||
"../util",
|
"../util",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (crashpad_is_ios) {
|
|
||||||
deps -= [
|
|
||||||
"../compat",
|
|
||||||
"../util",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (crashpad_is_mac) {
|
if (crashpad_is_mac) {
|
||||||
libs = [ "bsm" ]
|
libs = [ "bsm" ]
|
||||||
deps += [
|
deps += [
|
||||||
@ -154,6 +132,10 @@ static_library("test") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
deps += [ ":test_bundle_data" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (crashpad_is_win) {
|
if (crashpad_is_win) {
|
||||||
libs = [ "shell32.lib" ]
|
libs = [ "shell32.lib" ]
|
||||||
}
|
}
|
||||||
@ -166,6 +148,17 @@ static_library("test") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
bundle_data("test_bundle_data") {
|
||||||
|
testonly = true
|
||||||
|
|
||||||
|
sources = [ "test_paths_test_data_root.txt" ]
|
||||||
|
|
||||||
|
outputs = [ "{{bundle_resources_dir}}/crashpad_test_data/" +
|
||||||
|
"{{source_root_relative_dir}}/{{source_file_part}}" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
source_set("test_test") {
|
source_set("test_test") {
|
||||||
testonly = true
|
testonly = true
|
||||||
|
|
||||||
@ -178,15 +171,6 @@ source_set("test_test") {
|
|||||||
"test_paths_test.cc",
|
"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
|
# TODO(crbug.com/812974): Remove !crashpad_is_fuchsia when Fuchsia is no
|
||||||
# longer treated as a posix platform.
|
# longer treated as a posix platform.
|
||||||
if (crashpad_is_posix && !crashpad_is_fuchsia && !crashpad_is_ios) {
|
if (crashpad_is_posix && !crashpad_is_fuchsia && !crashpad_is_ios) {
|
||||||
@ -197,6 +181,13 @@ source_set("test_test") {
|
|||||||
sources += [ "mac/mach_multiprocess_test.cc" ]
|
sources += [ "mac/mach_multiprocess_test.cc" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
sources -= [
|
||||||
|
"multiprocess_exec_test.cc",
|
||||||
|
"scoped_guarded_page_test.cc",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if (crashpad_is_win) {
|
if (crashpad_is_win) {
|
||||||
sources += [
|
sources += [
|
||||||
"win/win_child_process_test.cc",
|
"win/win_child_process_test.cc",
|
||||||
@ -216,11 +207,6 @@ source_set("test_test") {
|
|||||||
data_deps = [ ":crashpad_test_test_multiprocess_exec_test_child" ]
|
data_deps = [ ":crashpad_test_test_multiprocess_exec_test_child" ]
|
||||||
|
|
||||||
if (crashpad_is_ios) {
|
if (crashpad_is_ios) {
|
||||||
deps -= [
|
|
||||||
"../compat",
|
|
||||||
"../util",
|
|
||||||
]
|
|
||||||
|
|
||||||
data_deps -= [ ":crashpad_test_test_multiprocess_exec_test_child" ]
|
data_deps -= [ ":crashpad_test_test_multiprocess_exec_test_child" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ base::FilePath TestDataRootInternal() {
|
|||||||
#if defined(OS_FUCHSIA)
|
#if defined(OS_FUCHSIA)
|
||||||
base::FilePath asset_path("/pkg/data");
|
base::FilePath asset_path("/pkg/data");
|
||||||
if (!IsTestDataRoot(asset_path)) {
|
if (!IsTestDataRoot(asset_path)) {
|
||||||
LOG(WARNING) << "Test data root seems invalid, continuing anyway";
|
LOG(WARNING) << "test data root seems invalid, continuing anyway";
|
||||||
}
|
}
|
||||||
return asset_path;
|
return asset_path;
|
||||||
#else // defined(OS_FUCHSIA)
|
#else // defined(OS_FUCHSIA)
|
||||||
@ -65,19 +65,23 @@ base::FilePath TestDataRootInternal() {
|
|||||||
return base::FilePath(environment_value);
|
return base::FilePath(environment_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// In a standalone build, the test executable is usually at
|
|
||||||
// out/{Debug,Release} relative to the Crashpad root.
|
|
||||||
base::FilePath executable_path;
|
base::FilePath executable_path;
|
||||||
if (Paths::Executable(&executable_path)) {
|
if (Paths::Executable(&executable_path)) {
|
||||||
#if defined(OS_ANDROID)
|
#if defined(OS_IOS) || defined(OS_ANDROID)
|
||||||
|
// On Android and iOS, test data is in a crashpad_test_data directory
|
||||||
|
// adjacent to the main executable. On iOS, this refers to the main
|
||||||
|
// executable file inside the .app bundle, so crashpad_test_data is also
|
||||||
|
// inside the bundle.
|
||||||
base::FilePath candidate = executable_path.DirName()
|
base::FilePath candidate = executable_path.DirName()
|
||||||
.Append("crashpad_test_data");
|
.Append("crashpad_test_data");
|
||||||
#else
|
#else // OS_IOS || OS_ANDRID
|
||||||
|
// In a standalone build, the test executable is usually at
|
||||||
|
// out/{Debug,Release} relative to the Crashpad root.
|
||||||
base::FilePath candidate =
|
base::FilePath candidate =
|
||||||
base::FilePath(executable_path.DirName()
|
base::FilePath(executable_path.DirName()
|
||||||
.Append(base::FilePath::kParentDirectory)
|
.Append(base::FilePath::kParentDirectory)
|
||||||
.Append(base::FilePath::kParentDirectory));
|
.Append(base::FilePath::kParentDirectory));
|
||||||
#endif
|
#endif // OS_IOS || OS_ANDROID
|
||||||
if (IsTestDataRoot(candidate)) {
|
if (IsTestDataRoot(candidate)) {
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
|
@ -244,14 +244,13 @@ static_library("util") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crashpad_is_ios) {
|
if (crashpad_is_mac || crashpad_is_ios) {
|
||||||
sources += [
|
sources += [
|
||||||
"ios/exception_processor.h",
|
|
||||||
"ios/exception_processor.mm",
|
|
||||||
"ios/ios_system_data_collector.h",
|
|
||||||
"ios/ios_system_data_collector.mm",
|
|
||||||
"mac/xattr.cc",
|
"mac/xattr.cc",
|
||||||
"mac/xattr.h",
|
"mac/xattr.h",
|
||||||
|
"misc/clock_mac.cc",
|
||||||
|
"misc/paths_mac.cc",
|
||||||
|
"synchronization/semaphore_mac.cc",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,8 +263,6 @@ static_library("util") {
|
|||||||
"mac/mac_util.h",
|
"mac/mac_util.h",
|
||||||
"mac/service_management.cc",
|
"mac/service_management.cc",
|
||||||
"mac/service_management.h",
|
"mac/service_management.h",
|
||||||
"mac/xattr.cc",
|
|
||||||
"mac/xattr.h",
|
|
||||||
"mach/child_port_handshake.cc",
|
"mach/child_port_handshake.cc",
|
||||||
"mach/child_port_handshake.h",
|
"mach/child_port_handshake.h",
|
||||||
"mach/child_port_server.cc",
|
"mach/child_port_server.cc",
|
||||||
@ -298,13 +295,19 @@ static_library("util") {
|
|||||||
"mach/task_for_pid.cc",
|
"mach/task_for_pid.cc",
|
||||||
"mach/task_for_pid.h",
|
"mach/task_for_pid.h",
|
||||||
"misc/capture_context_mac.S",
|
"misc/capture_context_mac.S",
|
||||||
"misc/clock_mac.cc",
|
|
||||||
"misc/paths_mac.cc",
|
|
||||||
"net/http_transport_mac.mm",
|
"net/http_transport_mac.mm",
|
||||||
"posix/process_info_mac.cc",
|
"posix/process_info_mac.cc",
|
||||||
"process/process_memory_mac.cc",
|
"process/process_memory_mac.cc",
|
||||||
"process/process_memory_mac.h",
|
"process/process_memory_mac.h",
|
||||||
"synchronization/semaphore_mac.cc",
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
sources += [
|
||||||
|
"ios/exception_processor.h",
|
||||||
|
"ios/exception_processor.mm",
|
||||||
|
"ios/ios_system_data_collector.h",
|
||||||
|
"ios/ios_system_data_collector.mm",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,12 +658,15 @@ source_set("util_test") {
|
|||||||
sources += [ "posix/scoped_mmap_test.cc" ]
|
sources += [ "posix/scoped_mmap_test.cc" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_mac || crashpad_is_ios) {
|
||||||
|
sources += [ "mac/xattr_test.cc" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (crashpad_is_mac) {
|
if (crashpad_is_mac) {
|
||||||
sources += [
|
sources += [
|
||||||
"mac/launchd_test.mm",
|
"mac/launchd_test.mm",
|
||||||
"mac/mac_util_test.mm",
|
"mac/mac_util_test.mm",
|
||||||
"mac/service_management_test.mm",
|
"mac/service_management_test.mm",
|
||||||
"mac/xattr_test.cc",
|
|
||||||
"mach/child_port_handshake_test.cc",
|
"mach/child_port_handshake_test.cc",
|
||||||
"mach/child_port_server_test.cc",
|
"mach/child_port_server_test.cc",
|
||||||
"mach/composite_mach_message_server_test.cc",
|
"mach/composite_mach_message_server_test.cc",
|
||||||
@ -684,20 +690,9 @@ source_set("util_test") {
|
|||||||
sources += [ "ios/exception_processor_test.mm" ]
|
sources += [ "ios/exception_processor_test.mm" ]
|
||||||
|
|
||||||
sources -= [
|
sources -= [
|
||||||
"file/directory_reader_test.cc",
|
|
||||||
"file/file_io_test.cc",
|
|
||||||
"file/filesystem_test.cc",
|
|
||||||
"misc/capture_context_test.cc",
|
"misc/capture_context_test.cc",
|
||||||
"misc/clock_test.cc",
|
|
||||||
"misc/paths_test.cc",
|
|
||||||
"net/http_body_test.cc",
|
|
||||||
"net/http_multipart_builder_test.cc",
|
|
||||||
"process/process_memory_range_test.cc",
|
"process/process_memory_range_test.cc",
|
||||||
"process/process_memory_test.cc",
|
"process/process_memory_test.cc",
|
||||||
"stream/file_encoder_test.cc",
|
|
||||||
"synchronization/semaphore_test.cc",
|
|
||||||
"thread/thread_test.cc",
|
|
||||||
"thread/worker_thread_test.cc",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +738,12 @@ source_set("util_test") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data = [ "net/testdata/" ]
|
data = [
|
||||||
|
"net/testdata/ascii_http_body.txt",
|
||||||
|
"net/testdata/binary_http_body.dat",
|
||||||
|
"net/testdata/crashpad_util_test_cert.pem",
|
||||||
|
"net/testdata/crashpad_util_test_key.pem",
|
||||||
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":util",
|
":util",
|
||||||
@ -756,10 +756,6 @@ source_set("util_test") {
|
|||||||
"../third_party/zlib",
|
"../third_party/zlib",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (crashpad_is_android || crashpad_is_linux) {
|
|
||||||
deps += [ "../third_party/lss" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!crashpad_is_android && !crashpad_is_ios) {
|
if (!crashpad_is_android && !crashpad_is_ios) {
|
||||||
data_deps = [ ":http_transport_test_server" ]
|
data_deps = [ ":http_transport_test_server" ]
|
||||||
|
|
||||||
@ -772,6 +768,14 @@ source_set("util_test") {
|
|||||||
libs = [ "Foundation.framework" ]
|
libs = [ "Foundation.framework" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
deps += [ ":util_test_bundle_data" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_android || crashpad_is_linux) {
|
||||||
|
deps += [ "../third_party/lss" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (crashpad_is_win) {
|
if (crashpad_is_win) {
|
||||||
libs = [
|
libs = [
|
||||||
"rpcrt4.lib",
|
"rpcrt4.lib",
|
||||||
@ -785,6 +789,20 @@ source_set("util_test") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crashpad_is_ios) {
|
||||||
|
bundle_data("util_test_bundle_data") {
|
||||||
|
testonly = true
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"net/testdata/ascii_http_body.txt",
|
||||||
|
"net/testdata/binary_http_body.dat",
|
||||||
|
]
|
||||||
|
|
||||||
|
outputs = [ "{{bundle_resources_dir}}/crashpad_test_data/" +
|
||||||
|
"{{source_root_relative_dir}}/{{source_file_part}}" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (crashpad_is_win) {
|
if (crashpad_is_win) {
|
||||||
crashpad_executable("crashpad_util_test_process_info_test_child") {
|
crashpad_executable("crashpad_util_test_process_info_test_child") {
|
||||||
testonly = true
|
testonly = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user