[scudo][standalone] Make tests work on Fuchsia
authorKostya Kortchinsky <kostyak@google.com>
Mon, 25 Nov 2019 18:28:57 +0000 (10:28 -0800)
committerKostya Kortchinsky <kostyak@google.com>
Wed, 27 Nov 2019 17:17:40 +0000 (09:17 -0800)
commit0d3d4d3b0fc57e577a8f80261bd4390c6cb7c040
tree2fe7d7b6133002882b33310966d5ac21e468fe55
parentbcd0798c47ca865f95226859893016a17402441e
[scudo][standalone] Make tests work on Fuchsia

Summary:
This CL makes unit tests compatible with Fuchsia's zxtest. This
required a few changes here and there, but also unearthed some
incompatibilities that had to be addressed.

A header is introduced to allow to account for the zxtest/gtest
differences, some `#if SCUDO_FUCHSIA` are used to disable incompatible
code (the 32-bit primary, or the exclusive TSD).

It also brought to my attention that I was using
`__scudo_default_options` in different tests, which ended up in a
single binary, and I am not sure how that ever worked. So move
this to the main cpp.

Additionally fully disable the secondary freelist on Fuchsia as we do
not track VMOs for secondary allocations, so no release possible.

With some modifications to Scudo's BUILD.gn in Fuchsia:
```
[==========] 79 tests from 23 test cases ran (10280 ms total).
[  PASSED  ] 79 tests
```

Reviewers: mcgrathr, phosek, hctim, pcc, eugenis, cferris

Subscribers: srhines, jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D70682
25 files changed:
compiler-rt/lib/scudo/standalone/allocator_config.h
compiler-rt/lib/scudo/standalone/secondary.h
compiler-rt/lib/scudo/standalone/tests/atomic_test.cpp
compiler-rt/lib/scudo/standalone/tests/bytemap_test.cpp
compiler-rt/lib/scudo/standalone/tests/checksum_test.cpp
compiler-rt/lib/scudo/standalone/tests/chunk_test.cpp
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
compiler-rt/lib/scudo/standalone/tests/flags_test.cpp
compiler-rt/lib/scudo/standalone/tests/list_test.cpp
compiler-rt/lib/scudo/standalone/tests/map_test.cpp
compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp
compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp
compiler-rt/lib/scudo/standalone/tests/release_test.cpp
compiler-rt/lib/scudo/standalone/tests/report_test.cpp
compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp
compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
compiler-rt/lib/scudo/standalone/tests/size_class_map_test.cpp
compiler-rt/lib/scudo/standalone/tests/stats_test.cpp
compiler-rt/lib/scudo/standalone/tests/strings_test.cpp
compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
compiler-rt/lib/scudo/standalone/tests/vector_test.cpp
compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp