diff --git a/compiler-rt/lib/gwp_asan/tests/alignment.cpp b/compiler-rt/lib/gwp_asan/tests/alignment.cpp --- a/compiler-rt/lib/gwp_asan/tests/alignment.cpp +++ b/compiler-rt/lib/gwp_asan/tests/alignment.cpp @@ -9,6 +9,8 @@ #include "gwp_asan/tests/harness.h" #include "gwp_asan/utilities.h" +#include + TEST(AlignmentTest, PowerOfTwo) { std::vector> AskedSizeToAlignedSize = { {1, 1}, {2, 2}, {3, 4}, {4, 4}, {5, 8}, {7, 8}, diff --git a/compiler-rt/lib/gwp_asan/tests/compression.cpp b/compiler-rt/lib/gwp_asan/tests/compression.cpp --- a/compiler-rt/lib/gwp_asan/tests/compression.cpp +++ b/compiler-rt/lib/gwp_asan/tests/compression.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "gwp_asan/stack_trace_compressor.h" -#include "gtest/gtest.h" +#include "gwp_asan/tests/harness.h" namespace gwp_asan { namespace compression { diff --git a/compiler-rt/lib/gwp_asan/tests/crash_handler_api.cpp b/compiler-rt/lib/gwp_asan/tests/crash_handler_api.cpp --- a/compiler-rt/lib/gwp_asan/tests/crash_handler_api.cpp +++ b/compiler-rt/lib/gwp_asan/tests/crash_handler_api.cpp @@ -16,7 +16,7 @@ using AllocationMetadata = gwp_asan::AllocationMetadata; using AllocatorState = gwp_asan::AllocatorState; -class CrashHandlerAPITest : public ::testing::Test { +class CrashHandlerAPITest : public Test { public: void SetUp() override { setupState(); } diff --git a/compiler-rt/lib/gwp_asan/tests/driver.cpp b/compiler-rt/lib/gwp_asan/tests/driver.cpp --- a/compiler-rt/lib/gwp_asan/tests/driver.cpp +++ b/compiler-rt/lib/gwp_asan/tests/driver.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "gtest/gtest.h" +#include "gwp_asan/tests/harness.h" int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); diff --git a/compiler-rt/lib/gwp_asan/tests/harness.h b/compiler-rt/lib/gwp_asan/tests/harness.h --- a/compiler-rt/lib/gwp_asan/tests/harness.h +++ b/compiler-rt/lib/gwp_asan/tests/harness.h @@ -11,7 +11,13 @@ #include +#if defined(__Fuchsia__) +#include +using Test = ::zxtest::Test; +#else #include "gtest/gtest.h" +using Test = ::testing::Test; +#endif #include "gwp_asan/guarded_pool_allocator.h" #include "gwp_asan/optional/backtrace.h" @@ -32,7 +38,7 @@ }; // namespace test }; // namespace gwp_asan -class DefaultGuardedPoolAllocator : public ::testing::Test { +class DefaultGuardedPoolAllocator : public Test { public: void SetUp() override { gwp_asan::options::Options Opts; @@ -51,7 +57,7 @@ MaxSimultaneousAllocations; }; -class CustomGuardedPoolAllocator : public ::testing::Test { +class CustomGuardedPoolAllocator : public Test { public: void InitNumSlots(decltype(gwp_asan::options::Options::MaxSimultaneousAllocations) @@ -74,7 +80,7 @@ MaxSimultaneousAllocations; }; -class BacktraceGuardedPoolAllocator : public ::testing::Test { +class BacktraceGuardedPoolAllocator : public Test { public: void SetUp() override { gwp_asan::options::Options Opts; diff --git a/compiler-rt/lib/gwp_asan/tests/harness.cpp b/compiler-rt/lib/gwp_asan/tests/harness.cpp --- a/compiler-rt/lib/gwp_asan/tests/harness.cpp +++ b/compiler-rt/lib/gwp_asan/tests/harness.cpp @@ -1,4 +1,12 @@ -#include "harness.h" +//===-- harness.cpp ---------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "gwp_asan/tests/harness.h" namespace gwp_asan { namespace test { diff --git a/compiler-rt/lib/gwp_asan/tests/iterate.cpp b/compiler-rt/lib/gwp_asan/tests/iterate.cpp --- a/compiler-rt/lib/gwp_asan/tests/iterate.cpp +++ b/compiler-rt/lib/gwp_asan/tests/iterate.cpp @@ -8,6 +8,9 @@ #include "gwp_asan/tests/harness.h" +#include +#include + TEST_F(CustomGuardedPoolAllocator, Iterate) { InitNumSlots(7); std::vector> Allocated; diff --git a/compiler-rt/lib/gwp_asan/tests/late_init.cpp b/compiler-rt/lib/gwp_asan/tests/late_init.cpp --- a/compiler-rt/lib/gwp_asan/tests/late_init.cpp +++ b/compiler-rt/lib/gwp_asan/tests/late_init.cpp @@ -8,7 +8,7 @@ #include "gwp_asan/guarded_pool_allocator.h" #include "gwp_asan/options.h" -#include "gtest/gtest.h" +#include "gwp_asan/tests/harness.h" TEST(LateInit, CheckLateInitIsOK) { gwp_asan::GuardedPoolAllocator GPA; diff --git a/compiler-rt/lib/gwp_asan/tests/mutex_test.cpp b/compiler-rt/lib/gwp_asan/tests/mutex_test.cpp --- a/compiler-rt/lib/gwp_asan/tests/mutex_test.cpp +++ b/compiler-rt/lib/gwp_asan/tests/mutex_test.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "gwp_asan/mutex.h" -#include "gtest/gtest.h" +#include "gwp_asan/tests/harness.h" #include #include diff --git a/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp b/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp --- a/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp +++ b/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp @@ -8,6 +8,8 @@ #include "gwp_asan/tests/harness.h" +#include + void singleByteGoodAllocDealloc(gwp_asan::GuardedPoolAllocator *GPA) { void *Ptr = GPA->allocate(1); EXPECT_NE(nullptr, Ptr);