fuchsia: Get crashpad_util_test building

Links, but various tests fail.

Also adds support to run_tests.py to run a single binary, likely only
useful on Fuchsia.

Bug: crashpad:196
Change-Id: Ie82ef26ec214ff4262194e877469953aa8fb367e
Reviewed-on: https://chromium-review.googlesource.com/809467
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Scott Graham 2017-12-05 15:16:08 -08:00 committed by Commit Bot
parent 2403d066c4
commit bfeb194b01
3 changed files with 48 additions and 24 deletions

View File

@ -151,11 +151,12 @@ def _RunOnFuchsiaTarget(binary_dir, test, device_name):
# that are run is maintained in-tree, rather than in a separate infrastructure
# location in the recipe.
def main(args):
if len(args) != 1:
print('usage: run_tests.py <binary_dir>', file=sys.stderr)
if len(args) != 1 and len(args) != 2:
print('usage: run_tests.py <binary_dir> [test_to_run]', file=sys.stderr)
return 1
binary_dir = args[0]
single_test = args[1] if len(args) == 2 else None
# Tell 64-bit Windows tests where to find 32-bit test executables, for
# cross-bitted testing. This relies on the fact that the GYP build by default
@ -174,6 +175,7 @@ def main(args):
tests = [
'crashpad_minidump_test',
'crashpad_test_test',
'crashpad_util_test',
]
if not is_fuchsia:
@ -183,7 +185,6 @@ def main(args):
'crashpad_client_test',
'crashpad_handler_test',
'crashpad_snapshot_test',
'crashpad_util_test',
])
if is_fuchsia:
@ -198,24 +199,29 @@ def main(args):
return 2
zircon_nodename = devices[0].strip().split()[1]
print('Using autodetected Fuchsia device:', zircon_nodename)
_GenerateFuchsiaRuntimeDepsFiles(binary_dir, tests)
_GenerateFuchsiaRuntimeDepsFiles(
binary_dir, [t for t in tests if not t.endswith('.py')])
elif IS_WINDOWS_HOST:
tests.append('snapshot/win/end_to_end_test.py')
if single_test:
if single_test not in tests:
print('Unrecognized test:', single_test, file=sys.stderr)
return 3
tests = [single_test]
for test in tests:
print('-' * 80)
print(test)
print('-' * 80)
if is_fuchsia:
_RunOnFuchsiaTarget(binary_dir, test, zircon_nodename)
if test.endswith('.py'):
print('-' * 80)
print(test)
print('-' * 80)
subprocess.check_call(
[sys.executable, os.path.join(CRASHPAD_DIR, test), binary_dir])
else:
subprocess.check_call(os.path.join(binary_dir, test))
if sys.platform == 'win32':
script = 'snapshot/win/end_to_end_test.py'
print('-' * 80)
print(script)
print('-' * 80)
subprocess.check_call(
[sys.executable, os.path.join(CRASHPAD_DIR, script), binary_dir])
if is_fuchsia:
_RunOnFuchsiaTarget(binary_dir, test, zircon_nodename)
else:
subprocess.check_call(os.path.join(binary_dir, test))
return 0

View File

@ -150,7 +150,6 @@ static_library("util") {
"misc/clock_posix.cc",
"posix/close_stdio.cc",
"posix/close_stdio.h",
"posix/process_info.h",
"posix/scoped_dir.cc",
"posix/scoped_dir.h",
"posix/scoped_mmap.cc",
@ -169,6 +168,7 @@ static_library("util") {
"posix/double_fork_and_exec.h",
"posix/drop_privileges.cc",
"posix/drop_privileges.h",
"posix/process_info.h",
# These map signals to and from strings. While Fuchsia defines some of
# the common SIGx defines, signals are never raised on Fuchsia, so
@ -378,16 +378,11 @@ source_set("util_test") {
"net/http_body_test_util.cc",
"net/http_body_test_util.h",
"net/http_multipart_builder_test.cc",
"net/http_transport_test.cc",
"net/url_test.cc",
"numeric/checked_address_range_test.cc",
"numeric/checked_range_test.cc",
"numeric/in_range_cast_test.cc",
"numeric/int128_test.cc",
"posix/process_info_test.cc",
"posix/scoped_mmap_test.cc",
"posix/signals_test.cc",
"posix/symbolic_constants_posix_test.cc",
"stdlib/aligned_allocator_test.cc",
"stdlib/map_insert_test.cc",
"stdlib/string_number_conversion_test.cc",
@ -401,6 +396,25 @@ source_set("util_test") {
"thread/worker_thread_test.cc",
]
if (!is_fuchsia) {
# TODO(scottmg): This requires an implementation of MultiprocessExec for
# testing, and a solution to http_transport_test_server.py -- either a port
# to non-Python, or method of forwarding those requests back to the builder
# host.
sources += [ "net/http_transport_test.cc" ]
}
if (is_posix) {
if (!is_fuchsia) {
sources += [
"posix/process_info_test.cc",
"posix/signals_test.cc",
"posix/symbolic_constants_posix_test.cc",
]
}
sources += [ "posix/scoped_mmap_test.cc" ]
}
if (is_mac) {
sources += [
"mac/launchd_test.mm",

View File

@ -23,6 +23,8 @@
#include "util/win/address_types.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID)
#include "util/linux/address_types.h"
#elif defined(OS_FUCHSIA)
#include <zircon/types.h>
#endif // OS_MACOSX
namespace crashpad {
@ -129,6 +131,8 @@ template class CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t>;
template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>;
#elif defined(OS_LINUX) || defined(OS_ANDROID)
template class CheckedAddressRangeGeneric<LinuxVMAddress, LinuxVMSize>;
#elif defined(OS_FUCHSIA)
template class CheckedAddressRangeGeneric<zx_vaddr_t, size_t>;
#endif // OS_MACOSX
} // namespace internal