102 Commits

Author SHA1 Message Date
Justin Cohen
71695216f9 ios: Fix Xcode project buildgen.
Change-Id: Ib9701a2c7c7ebc55ba69e1e6fa9cde59d3e4c557
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2378400
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-08-27 15:59:07 +00:00
Scott Graham
b472408135 fuchsia: Remove run_tests.py functionality
This removes the rotted functionality for running tests on Fuchsia. It
had previously been broken by other platform changes. Other tools are
from previous SDKs being removed too; this approach is no longer going
to work.

The preferred way is to connect via SSH to the device, however, that
requires using the femu.sh from the SDK, which in turn requires `sudo`
to create a network device, so it won't directly work on bots anyway.

I started trying to update the to use femu.sh, fserve.sh, & fpublish.sh,
but that requires building a .far, which uses GN templates which
differ from the in-tree versions, and don't seem (?) to support
packaging resources into the package.

So, for now because it was confusing people (see linked bug) give up and
delete the code for the time being.

Bug: fuchsia:54031
Change-Id: Iac7af80094b150d11e71474cba4bd93eb8e80639
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2354160
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-08-13 23:21:50 +00:00
Joshua Peraza
0cccdc0b7e Replace is_linux with is_linux || is_chromeos
Upstreams https://chromium-review.googlesource.com/c/chromium/src/+/2326293

Change-Id: I74379d1fbb8f9ec94e3e7eb969af0c8c492c9c07
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2342044
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-08-06 22:39:56 +00:00
Joshua Peraza
2f66eefb79 Update language to eliminate 'whitelist'
Change-Id: I6afe27313093c6867d0276274e6b17b195d9d263
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2339536
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-08-06 21:03:16 +00:00
Mark Mentovai
fd001f792e build: Make crashpad_dependencies="external" work in the GN build
…for macOS, at least.

Change-Id: Iba45328d957de17198180d171677a45468c9adc2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2290842
Reviewed-by: Eric Astor <epastor@google.com>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-07-11 03:33:33 +00:00
Mark Mentovai
828095ac32 Clear the gn sources_assignment_filter when building in Chromium
Chromium relies on a global gn sources assignment filter, even though
it’s kind of discouraged. Crashpad doesn’t use this, instead selecting
which files to build entirely with the logic in its .gn files. In some
cases, Chromium’s filters prevent _linux files from building on Android,
and _mac files from building on iOS, even though Crashpad’s build has
explicitly requested these inclusions. To overcome this problem,
clear the gn sources_assignment_filter in all of Crashpad’s own .gn
files when building in Chromium.

Change-Id: Iab0af29f4e5aff4be8eec2ee12b2e3f991c0a86d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285959
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
2020-07-08 04:29:24 +00:00
Rohit Rao
245fee1b63 Removes Chromium-specific args from setup_ios_gn.py.
Bug: None
Change-Id: Ic0f2352be57c0010ea6d951bec2754addba5cac0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285894
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
2020-07-08 01:25:35 +00:00
Rohit Rao
17b08b5aab Copies the latest setup_ios_gn.py from Chromium.
Also includes the latest convert_gn_xcodeproj.py.

BUG=None

Change-Id: Icd82dd248ebf30b98054336d82f73a70d63f1d71
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2276602
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
2020-07-07 12:41:12 +00:00
John Wittrock
38f6034998 fuchsia: add invtsc to qemu command line
This puts the command line in sync with the fuchsia-internal way of
running emulators, which may help alleviate flakes in Chromium infra.

Bug: chromium:1092054
Change-Id: I0e52107e24f1b5b09d35348a47d2485e227a416c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2240144
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-06-10 21:12:14 +00:00
Mark Mentovai
b065c6c436 android: Allow cross development from non-Linux build hosts (again)
This regressed in e97cf7b29c16.

Change-Id: I8e82478e80ce8c56926b737c00506a4ff9a1bffd
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186352
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-07 14:56:13 +00:00
Mark Mentovai
a45eea40fc Update gtest to e3f0319d89f4cbf32993de595d984183b1a9fc57
I’m most interested in picking up 1b3eb6ef3462, “Explicitly define copy
constructors used in googletest tests.”

This also reorganizes files and rewrites text to refer to this project
as Google Test and googletest (and Google Mock and googlemock), as it
prefers to be known. Some filenames are left at gtest_* following the
precedent set by gtest itself. For example, #include "gtest/gtest.h" is
still used, so #include "test/gtest_death.h" is retained too.
gtest_all_test OutputFileHelpersTest.GetCurrentExecutableName hard-codes
the expected executable name as gtest_all_test among other options that
do not include googletest_all_test, so test executables retain their
names as well.

fb19f57880f6 Add GTEST_BRIEF option
3549237957a1 Ensure that gtest/gmock pkgconfig requirements specify
             version
189299e957bb Merge branch 'master' into quiet-flag
5504ded3ab5c Fix a typo in .travis.yml
6ed4e7168f54 Replace the last instance of `throw()` with `noexcept`. NFC
879fd9b45299 Remove duplicate codes existed in get-nprocessors.sh
644f3a992c28 gtest-unittest-api_test - fix warning in clang build
0b6d567619fe Remove redundant .c_str()
be3ac45cf673 fix signed/unsigned comparison issue (on OpenBSD)
b51a49e0cb82 Merge pull request #2773 from Quuxplusone:replace-noexcept
c2032090f373 Merge pull request #2772 from Quuxplusone:travis
4fe5ac53337e Merge pull request #2756 from Conan-Kudo:fix-pkgconfig-reqs
373d72b6986f Googletest export
4c8e6a9fe1c8 Merge pull request #2810 from ptahmose:master
71d5df6c6b67 Merge pull request #2802 from e-i-n-s:fix_clang_warning
dcc92d0ab6c4 Merge pull request #2805 from pepsiman:patch-1
4f002f1e236c VariadicMatcher needs a non-defaulted move constructor for
             compile-time performance
9d580ea80592 Enable protobuf printing for open-source proto messages
766ac2e1a413 Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_
11b3cec177b1 Fix a -Wdeprecated warning
01c0ff5e2373 Fix a -Wdeprecated warning
c7d8ec72cc4b Fix a -Wdeprecated warning
1b066f4edfd5 Add -Wdeprecated to the build configuration
4bab55dc54b4 Removed a typo in README.md
a67701056425 Googletest export
fb5d9b66c5b0 Googletest export
1b3eb6ef3462 Googletest export
b0e53e2d64db Merge pull request #2797 from Jyun-Neng:master
d7ca9af0049e Googletest export
955552518b4e Googletest export
ef25d27d4604 Merge pull request #2815 from Quuxplusone:simple
129329787429 Googletest export
b99b421d8d68 Merge pull request #2818 from inazarenko:master
472cd8fd8b1c Merge pull request #2818 from inazarenko:master
3cfb4117f7e5 Googletest export
0eea2e9fc634 Googletest export
a9f6c1ed1401 Googletest export
1a9c3e441407 Merge pull request #2830 from keshavgbpecdelhi:patch-1
e589a3371705 Merge pull request #2751 from calumr:quiet-flag

Change-Id: Id788a27aa884ef68a21bae6c178cd456f5f6f2b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186009
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-07 14:56:07 +00:00
Mark Mentovai
bac601e785 Use underscores instead of hyphens in filenames
Change-Id: I886a5cfc8092eb680163586b5855a86d407a34a8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165816
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-27 21:21:20 +00:00
Mark Mentovai
a5a1c3b07f Add .style.yapf and reformat according to yapf, using “google” style
% yapf --in-place $(git ls-files **/*.py)
% yapf --version
yapf 0.30.0

Note that this is not using the “chromium” yapf style because Chromium
is moving to PEP-8.
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/RcJgJdkNIdg
yapf 0.30.0 no longer recognizes “chromium” as a style option.
22ef70f3c4
Since this is a mass reformatting, it might as well move things all the
way into the future all at once.

This uses the “google” style, which is a superset of “pep8”.

Change-Id: Ifa37371079ea1859e4afe8e31d2eef2cfd7af384
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165637
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-04-27 13:59:09 +00:00
Joshua Peraza
e5dbfa3363 Disable fuzzing without use_fuzzing_engine
Effectively upstreams https://chromium-review.googlesource.com/c/chromium/src/+/1775756

Change-Id: I112eddd9e5f22790a50bf7b340cf9202eeceebc3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2148373
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-04-14 03:21:53 +00:00
Rohit Rao
42da41d24a Targets iPhone 8 when running tests.
The iPhone 8 simulator should be available in both Xcode 10.2 and Xcode 11.3.

BUG=None

Change-Id: I26570eb2406f67b3663ac9ecb7e7440c0f9fa70d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2085353
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
2020-03-03 20:05:10 +00:00
Justin Cohen
56ec176fda Fix Chromium checkperms.py has shebang but not executable bit error.
Change-Id: I0fc5d853a38f186bba9937d537a95db37e0604ac
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2032978
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-02-03 18:37:28 +00:00
Rohit Rao
46ad005e92 Updates run_tests.py to support testing on iOS.
Tests are run by creating an xctestrun file in a temp directory and then
invoking "xcodebuild test-without-building".  Tests run on the latest
OS version (the default for the running version of Xcode) on iPhone X.

Bug: crashpad:317
Change-Id: If9f34f8798fd4c2a02fecca180913e8f86011304
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2033606
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
2020-01-31 21:00:14 +00:00
Rohit Rao
39116ab723 Adds support for running iOS unittests via XCTest.
Using XCTest allows us to drive tests from the commandline via
xcodebuild, and it also simplifies running tests on physical devices.

Tests put themselves into "XCTest-mode" if the
"XCTestConfigurationFilePath" environment variable is present.  This
variable is only set when XCTests are running.

Change-Id: If55199a7470f0479f107097eef1dfb1a705015e9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2033427
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-31 20:14:04 +00:00
Justin Cohen
77baffaf93 Add iOS gn configs.
Allows more native iOS development with Xcode by auto generating all
the various configs during runhooks.

Change-Id: I840001caabc7ef656c3145b847cee5596335aa23
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2024186
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-01-29 15:46:32 +00:00
P.Y. Laligand
23a2da5e95 [fuchsia] Only add fdio config if it's not already present.
Change-Id: Ie5eef8fb76b7a9558791aae8572ec2c91d2e6b84
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2026287
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Francois Rousseau <frousseau@google.com>
2020-01-29 00:21:51 +00:00
Nico Weber
2fd16e3392 Reformat all gn files
Port of chromium-side
https://chromium-review.googlesource.com/c/chromium/src/+/1997899

Bug: chromium:1041419
Change-Id: Ic7afefa0dea024da37fe4bb0f965840a160e2166
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2015428
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-23 13:59:00 +00:00
Rohit Rao
54bbd7d0d5 Adds support for running GTests on iOS.
iOS needs to run tests from within the context of a UIApplication, and
it needs to periodically spin the runloop to ensure that the watchdog
does not kill the app for being unresponsive.

BUG=crashpad:31

Change-Id: Ia1d881e478d4f83c236b475a21529760c06100c7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1904226
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-07 17:08:53 +00:00
Rohit Rao
bd1aa246ca 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>
2019-11-07 16:55:37 +00:00
Joshua Peraza
e97cf7b29c update gyp_crashpad_android.py
This patch updates gyp_crashpad_android.py to function with NDK r20,
removes the requirement to generate a standalone toolchain, and updates
documentation on building for Android.

Also some gyp build fixes.

Change-Id: Ide338417ab2a21eca7a4bf42c1fb834e5639c186
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1798746
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-09-11 19:05:30 +00:00
Scott Graham
50aa576622 Disable implicit fallthrough warning for zlib
https://logs.chromium.org/logs/crashpad/buildbucket/cr-buildbucket.appspot.com/8903960674082840512/+/steps/compile_with_ninja/0/stdout

I don't understand how this lingered for so long as I can't see what
changed. mini_chromium has had -Wimplicit-fallthough enabled for a long
time (https://chromium-review.googlesource.com/899847), and zlib DEPS
hasn't changed in a long time either
(https://chromium-review.googlesource.com/438585).

The most likely would presumably be that the compiler started
not-ignoring the enabling of the warning? But that doesn't seem too
likely either.

Bug: crashpad:309
Change-Id: I57480cc3f669ef94d0234afaf980281b7ddf8c51
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1772205
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-08-27 19:18:05 +00:00
Jonathan Metzman
18aa41d48c [libFuzzer] Enable fuzz targets to build in Chromium
Enable building elf_image_reader_fuzzer in Chromium.
Rename it to crashpad_elf_image_reader_fuzzer so that its clearer
where the fuzzer comes from.
Import chromium's fuzzer_test definition when building in Chromium and
make sure fuzzer is only built on Linux since it breaks fuzzer build
on Win (and maybe Mac?).

Bug: 950093
Change-Id: I8afc104d26871311b04931b82a1600614a81bfc8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1597091
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-05-06 22:02:56 +00:00
Joshua Peraza
d396fdf9d4 Delete crashpad_dependencies.gni
The file doesn't appear to be referenced anywhere and its contents are
generally duplicated in test.gni and crashpad_buildconfig.gni.

Change-Id: Id65a3020330a968ce3bcfb23c30e4cd0c5f808f8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1541847
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-03-28 20:05:11 +00:00
Peter Collingbourne
75efc19dd0 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 <mark@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
2019-03-27 00:13:56 +00:00
Vyacheslav Egorov
bf327d8ceb Introduce "dart" dependencies configuration for embedding into Dart VM.
This configuration has the following dependencies layout:

* gtest should be pulled from //third_party/googletest
* zlib from //third_party/zlib
* base from //third_party/mini_chromium/mini_chromium/base
* Windows build configs come from //build/config/win:*.

Bug: crashpad:
Change-Id: I22b44d4f85349383063bf3785a321e3c23d88853
Reviewed-on: https://chromium-review.googlesource.com/c/1291378
Commit-Queue: Vyacheslav Egorov <vegorov@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-10-22 17:35:35 +00:00
Joshua Peraza
8068e2dd6d Remove references to exe_and_shlib_deps
Upstreams:
https://chromium-review.googlesource.com/c/chromium/src/+/1073613

Change-Id: Ieea63949eb4533061cf434157120a6e219897b6a
Reviewed-on: https://chromium-review.googlesource.com/1187012
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-24 17:23:47 +00:00
Adam Norberg
255a4e0c0e Add "external" dependency mode for Crashpad's GN build.
This is required for repositories that do not use Crashpad's
third_party/mini_chromium path because they have their own mini_chromium
as a peer to Crashpad.

Bug: crashpad:
Change-Id: I5a765da75fb9efebc4ada17467371d51112fd391
Reviewed-on: https://chromium-review.googlesource.com/1185885
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-08-24 17:14:21 +00:00
Mark Mentovai
e50ea60321 Make BuildHandlerArgvStrings() return its result
This is more direct than using an out-parameter. Copy elision should
make it equally performant, and even in the absence of copy elision,
this would now be an inexpensive move operation.

Change-Id: Iaf0eb07b36c8e35ff8942fc422a22321bf5c3010
Reviewed-on: https://chromium-review.googlesource.com/1145495
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-07-20 20:31:14 +00:00
Ryan Tseng
98ebb0060b Add whitespace file
Bug: 865729
TBR: dpranke
Change-Id: I906dd83cd4f96636f65efade8a9bd34b6e9bbb42
Reviewed-on: https://chromium-review.googlesource.com/1145587
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
2018-07-20 18:50:24 +00:00
Scott Graham
9a97daff39 Add libfuzzer support
Adds the build support for using libfuzzer controlled by setting
`crashpad_use_libfuzzer=true`.

Also adds a first fuzzer (for ElfImageReader). Currently only runs on
Linux, but should work on Fuchsia too with some minor fixes (not sure
yet whether the fixes required are toolchain or in our build setup).

Run as:
  out/lin/elf_image_reader_fuzzer snapshot/elf/elf_image_reader_fuzzer_corpus/
hits an OOM pretty quickly in trying to allocate a giant buffer.

Bug: crashpad:30, crashpad:196, crashpad:233
Change-Id: Idd3ca11fe00319b8b29e029d5e13b17bfd518ea0
Reviewed-on: https://chromium-review.googlesource.com/1083451
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-06-07 21:09:53 +00:00
Scott Graham
31703a585f fuchsia: When in Fuchsia tree, disable tests requiring external files
The package deployment/running is in flux at the moment. In order to get
all the other tests on to the main Fuchsia waterfall, disable the ~25
tests that require external files (for launching child processes,
loading modules, or data files) because those operations all fail on
Fuchsia-without-packages right now. Upstream this is PKG-46. Once test
packaging and running has been resolved, this can be reverted.

These tests are still run when building Crashpad standalone on Fuchsia
as the standalone build simply copies all the relevant data files to the
device in /tmp.

Bug: crashpad:196
Change-Id: I1677c394a2b9d709c59363ebeea8aff193d4c21d
Reviewed-on: https://chromium-review.googlesource.com/1045547
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-05-05 00:27:22 +00:00
Scott Graham
60ae9eeadb Implementation of HTTPTransport via raw socket
Partial implementation: Currently only handles http (i.e. no TLS), only
POST, and only certain response types (only when Content-Length is
specified, and not chunked). Used for Linux and Fuchsia lacking anything
better (that's shippable). Removes libcurl HTTPTransport, since it isn't
available in the Chromium sysroot anyway.

This is an intermediate step until BoringSSL is available in the Fuchsia
SDK. Once that's available, it should be "relatively straightfoward" to
make http_transport_socket.cc secure its socket using BoringSSL or
OpenSSL depending on the platform.

Bug: crashpad:196, crashpad:227, crashpad:30
Change-Id: If33a0d3f11b9000cbc3f52f96cd024ef274a922f
Reviewed-on: https://chromium-review.googlesource.com/1022717
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-04-27 04:04:30 +00:00
Scott Graham
78689cc810 fuchsia: Depend on fdio_config when in-tree
Fixes .so link errors from
https://logs.chromium.org/v/?s=fuchsia%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8948324805139372352%2F%2B%2Fsteps%2Fbuild%2F0%2Fsteps%2Fbuild_fuchsia%2F0%2Fsteps%2Fninja%2F0%2Fstdout

[7302/11459] SOLINK x64-shared/crashpad_snapshot_test_module_small.so

FAILED: x64-shared/crashpad_snapshot_test_module_small.so x64-shared/lib.unstripped/crashpad_snapshot_test_module_small.so
/b/s/w/ir/kitchen-workdir/cipd/goma/gomacc ../../buildtools/linux-x64/clang/bin/clang++ -shared -Wl,--threads --sysroot=/b/s/w/ir/kitchen-workdir/out/debug-x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot --target=x86_64-fuchsia -march=x86-64 -mcx16 -g -Og -Wl,--icf=all -Wl,--no-undefined -o "x64-shared/lib.unstripped/crashpad_snapshot_test_module_small.so" -Wl,-soname="crashpad_snapshot_test_module_small.so" @"x64-shared/crashpad_snapshot_test_module_small.so.rsp" && ../../buildtools/linux-x64/clang/bin/llvm-objcopy --strip-all "x64-shared/lib.unstripped/crashpad_snapshot_test_module_small.so" "x64-shared/crashpad_snapshot_test_module_small.so"
/b/s/w/ir/kitchen-workdir/out/debug-x64/../../buildtools/linux-x64/clang/bin/ld.lld: error: undefined symbol: dirfd
>>> referenced by directory_reader_posix.cc:72 (../../third_party/crashpad/util/file/directory_reader_posix.cc:72)
>>>               libutil.directory_reader_posix.o:(crashpad::DirectoryReader::DirectoryFD()) in archive x64-shared/obj/third_party/crashpad/util/libutil.a
/b/s/w/ir/kitchen-workdir/out/debug-x64/../../buildtools/linux-x64/clang/bin/ld.lld: error: undefined symbol: fdio_ioctl
>>> referenced by sysinfo.h:32 (../../out/debug-x64/zircon_toolchain/obj/zircon/public/sysroot/sysroot/include/zircon/device/sysinfo.h:32)
>>>               libutil.koid_utilities.o:(ioctl_sysinfo_get_root_job(int, unsigned int*)) in archive x64-shared/obj/third_party/crashpad/util/libutil.a
clang-7.0: error: ld.lld command failed with exit code 1 (use -v to see invocation)

Bug: crashpad:196
Change-Id: I50b50a8ba668d75d40e86d863976c386bb382f65
Reviewed-on: https://chromium-review.googlesource.com/1028840
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-25 21:28:29 +00:00
Joshua Peraza
9c89cd99f3 gn: add templates for executables and loadable_modules
When building in chromium, executables and loadable_modules should
depend on:
//build/config:exe_and_shlib_deps
which, among other things, may be needed to introduce a
dependency on a custom libc++.

Bug: crashpad:30
Change-Id: Ic46a3cf5b46bdac09cca22950f9236e0776ba44a
Reviewed-on: https://chromium-review.googlesource.com/974713
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-23 16:50:58 +00:00
Scott Graham
8e80a575d1 Linux: Pull a sysroot if pulling a local clang
Didn't actually end up being too bad. Also requires setting GN arg of

  target_sysroot = "//third_party/linux/sysroot"

when building.

Bug: crashpad:220
Change-Id: I4d4b282f165d454b5d32fc8cc11287ff665b943d
Reviewed-on: https://chromium-review.googlesource.com/935981
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-02-24 04:31:12 +00:00
Scott Graham
3030ae5417 fuchsia: Fix ninja auto-regen after run
After the avoidance of abspath(), automatic regeneration of ninja files
was broken following a test run. The problem is that the
--runtime-deps-list-file argument gets saved into the regeneration rule,
but it's relative to the cwd. The cwd is CRASHPAD_DIR on the first run,
but the binary_dir on regenerations, so either way it doesn't work (this
should probably fixed in either GN or ninja).

We could abspath the path the runtime deps targets file to avoid this.
However, it's a bit cluttery to have that --runtime-deps-list-file in
the regeneration rule anyway, when really it's only required to extract
runtime deps at test-running time. (Also, if you happened to delete only
targets.txt from the out dir, the regeneration would mysteriously fail.)
So since generation only takes tens of milliseconds, the best thing to
do is just remove it from the regeneration rule by re-running gn gen
without the flag after we've extracted the .runtime_deps to prepare for
the run.

Bug: crashpad:196, chromium:814816
Change-Id: I009851d8b821fef5c953d463ba9c4880e5cc082a
Reviewed-on: https://chromium-review.googlesource.com/929887
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-22 18:05:55 +00:00
Scott Graham
8ee14eef08 fuchsia: Fix some packaging when run isn't from Crashpad source root
- Use gn --root rather than setting the cwd when running GN so it can
find //.gn.

- Use source-relative path for assets when building the target path, see
for example the failure in:
https://build.chromium.org/p/client.crashpad/builders/crashpad_fuchsia_x64_rel/builds/77/steps/run%20tests/logs/stdio

Bug: crashpad:196
Change-Id: If95636fcb826c22d9d9543cad02f815780621414
Reviewed-on: https://chromium-review.googlesource.com/923436
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-16 21:58:18 +00:00
Scott Graham
798f654043 gn win: Use new toolchain names to support both x86 and x64
Rolls mini_chromium to include:
75b5697 gn win: Template toolchain to support x86 and x64
428a555 gn win: Automatically find location of Visual Studio

Bug: crashpad:79
Change-Id: Ie7ff10f8b4853071028e3a9580e5be8e5ca5c0ec
Reviewed-on: https://chromium-review.googlesource.com/905625
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-06 23:35:49 +00:00
Scott Graham
14dbd3531d gn win: Get main test binaries building
- default to subsystem:console
- don't build posix/timezone.*
- add some missing libs

This gets all the main binaries building and running. Most configs pass,
but there's some offsets that seem different in some builds; need to
investigate more. Additionally, the binaries used by end_to_end_test.py
aren't yet built, so that script fails.

Includes mini_chromium roll to 46eeaf9:
46eea49 gn win: Add debug info and pdb to cc/cxx
902a29f gn win: Various fixes towards making GN build work

Bug: crashpad:79
Change-Id: Ie56a469b84bed7b0330172cec9f1a8aeb95f702e
Reviewed-on: https://chromium-review.googlesource.com/902403
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-06 19:12:18 +00:00
Scott Graham
1f1657d573 Read either DT_HASH or DT_GNU_HASH to determine the size of DT_SYMTAB
Without the section headers for the symbol table, there's no direct way
to calculate the number of entries in the table.

DT_HASH and DT_GNU_HASH are auxiliary tables that are designed to make
symbol lookup faster. DT_HASH is the original and is theoretically
mandatory. DT_GNU_HASH is the new-and-improved, but is more complex.

In practice, however, an Android build (at least vs. API 16) has only
DT_HASH, and not DT_GNU_HASH, and a Fuchsia build has only DT_GNU_HASH
but not DT_HASH. So, both are tried.

This change does not actually use the data in these tables to improve
the speed of symbol lookup, but instead only uses them to correctly
terminate the linear search.

DT_HASH contains the total number of symbols in the symbol table fairly
directly because there is an entry for each symbol table entry in the
hash table, so the number is the same.

DT_GNU_HASH regrettably does not. Instead, it's necessary to walk the
buckets and chain structure to find the largest entry.

DT_GNU_HASH doesn't appear in any "real" documentation that I'm aware
of, other than the binutils code (at least as far as I know). Some
more-and-less-useful references:
- https://flapenguin.me/2017/04/24/elf-lookup-dt-hash/
- https://flapenguin.me/2017/05/10/elf-lookup-dt-gnu-hash/
- http://deroko.phearless.org/dt_gnu_hash.txt
- https://sourceware.org/ml/binutils/2006-10/msg00377.html

Change-Id: I7cfc4372f29efc37446f0931d22a1f790e44076f
Bug: crashpad:213, crashpad:196
Reviewed-on: https://chromium-review.googlesource.com/876879
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-01-30 22:40:17 +00:00
Scott Graham
48abd4a60f Add CRASHPAD_CHILD_TEST_MAIN() helper for multiprocess tests
Extends MultiprocessExec to support running functions registered via
CRASHPAD_CHILD_TEST_MAIN() as the main of a new child process.

Additionally, implements Fuchsia exit code checking, and adds a
CRASHPAD_CHILD_TEST_MAIN()-based test for that.

Bug: crashpad:196, crashpad:215
Change-Id: I49ce3f4d95a3b9823813e6df5a602cee2583bcf8
Reviewed-on: https://chromium-review.googlesource.com/879563
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-25 22:59:20 +00:00
Scott Graham
7e7193d5f1 fuchsia: Update expected mini_chromium location for in-Fuchsia build
The initial plan was to have crashpad and mini_chromium be siblings in
the Fuchsia tree, but the Fuchsia team sensibly preferred to nest
mini_chromium inside Crashpad
https://fuchsia-review.googlesource.com/c/garnet/+/115120, so update the
expected location to match. Conveniently this is where mini_chromium
lives in a normal standalone build too.

Bug: crashpad:196
Change-Id: Iedab0dd557fa248c6419380b676b71427279bba1
Reviewed-on: https://chromium-review.googlesource.com/883569
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-01-24 18:59:05 +00:00
Scott Graham
c9b41a4d15 fuchsia: Fix removal of /tmp dir on test run, and location of .so files
1. .so files should (I believe) be in /pkg/lib according to
https://fuchsia.googlesource.com/docs/+/master/namespaces.md#typical-directory-structure
(None of the tests that load .so actually work currently, so it doesn't
make anything better or worse to fix this.)

2. The test directory structure looks like:
- /tmp/<guid>/pkg/...
- /tmp/<guid>/tmp/...

Previously /tmp/<guid>/pkg/ and /tmp/<guid>/tmp/ were being removed, but
/tmp/<guid>/ wasn't so there was a bunch of empty directory garbage
being left in /tmp. Clean up from the root instead.

Bug: crashpad:196
Change-Id: I4e82198721f329d597e14a89da8bc77fcc8647c6
Reviewed-on: https://chromium-review.googlesource.com/880884
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-23 19:49:10 +00:00
Scott Graham
3a7b80995d fuchsia: Default crashpad_dependencies based on is_fuchsia_tree
Bug: crashpad:196
Change-Id: I0ff0157287e8b84323068741e060ff3c10f9719a
Reviewed-on: https://chromium-review.googlesource.com/871044
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-18 23:48:58 +00:00
Scott Graham
4431f76d86 Switch run_tests.py to argparse, and support --gtest_filter
Starting to work on individual tests on Fuchsia, and it's nice to be
to run only one.

Bug: crashpad:196
Change-Id: I1c5d924d2c93ee943673883de0a6022a3666f98c
Reviewed-on: https://chromium-review.googlesource.com/865103
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-12 22:47:33 +00:00
Scott Graham
54dc88724e fuchsia: Fix run when gn binary path non-absolute
Oops. I thought GN abspath()d this in the regen rule, but it does not.

Bug: crashpad:196
Change-Id: I33dadc5502a5e56f20ba7e4c0403fbc138f052c9
Reviewed-on: https://chromium-review.googlesource.com/864629
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-12 18:59:13 +00:00