From 75efc19dd0d5479793414549d21ba00370a52efb Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 26 Mar 2019 11:36:34 -0700 Subject: [PATCH] Make most of the tests pass on Android. - Link with -static-libstdc++ to avoid a runtime dependency on the NDK libc++. - Relax the regular expression matching the path to ar. If the path is sufficiently long then gyp will wrap the line, causing the match to fail. - The crashpad_handler binary needs to be pushed to the device, otherwise a number of tests fail or hang. Now the only tests that fail on my device are: [ FAILED ] DebugRendezvous.Self [ FAILED ] DebugRendezvous.Child [ FAILED ] ProcessReaderLinux.SelfModules [ FAILED ] ProcessReaderLinux.ChildModules Change-Id: I951a22cea5bce453d858da49a49b6a8defc1461c Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1536652 Reviewed-by: Mark Mentovai Commit-Queue: Peter Collingbourne --- build/crashpad.gypi | 5 +++++ build/run_tests.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build/crashpad.gypi b/build/crashpad.gypi index 166e768f..2accb5a0 100644 --- a/build/crashpad.gypi +++ b/build/crashpad.gypi @@ -35,6 +35,11 @@ }], ], }], + ['OS=="android"', { + 'ldflags': [ + '-static-libstdc++', + ], + }], ], }, } diff --git a/build/run_tests.py b/build/run_tests.py index df7d8af1..29fd3c1b 100755 --- a/build/run_tests.py +++ b/build/run_tests.py @@ -87,7 +87,7 @@ def _BinaryDirTargetOS(binary_dir): if os.path.exists(build_ninja_path): with open(build_ninja_path) as build_ninja_file: build_ninja_content = build_ninja_file.read() - match = re.search('^ar = .+-linux-android(eabi)?-ar$', + match = re.search('-linux-android(eabi)?-ar$', build_ninja_content, re.MULTILINE) if match: @@ -237,7 +237,7 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line): # determined automatically in a GN build, following the example used for # Fuchsia. Since nothing like that exists for GYP, hard-code it for # supported tests. - test_build_artifacts = [test] + test_build_artifacts = [test, 'crashpad_handler'] test_data = ['test/test_paths_test_data_root.txt'] if test == 'crashpad_test_test':