summaryrefslogtreecommitdiff
path: root/compiler-rt/lib/gwp_asan/tests
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/gwp_asan/tests')
-rw-r--r--compiler-rt/lib/gwp_asan/tests/basic.cpp2
-rw-r--r--compiler-rt/lib/gwp_asan/tests/compression.cpp3
-rw-r--r--compiler-rt/lib/gwp_asan/tests/never_allocated.cpp2
-rw-r--r--compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp6
-rw-r--r--compiler-rt/lib/gwp_asan/tests/thread_contention.cpp4
5 files changed, 16 insertions, 1 deletions
diff --git a/compiler-rt/lib/gwp_asan/tests/basic.cpp b/compiler-rt/lib/gwp_asan/tests/basic.cpp
index 7d36a2ee1f94..ec2cacc00616 100644
--- a/compiler-rt/lib/gwp_asan/tests/basic.cpp
+++ b/compiler-rt/lib/gwp_asan/tests/basic.cpp
@@ -8,6 +8,8 @@
#include "gwp_asan/tests/harness.h"
+#include <unistd.h>
+
TEST_F(CustomGuardedPoolAllocator, BasicAllocation) {
InitNumSlots(1);
void *Ptr = GPA.allocate(1);
diff --git a/compiler-rt/lib/gwp_asan/tests/compression.cpp b/compiler-rt/lib/gwp_asan/tests/compression.cpp
index 2423c866a531..91b09770836a 100644
--- a/compiler-rt/lib/gwp_asan/tests/compression.cpp
+++ b/compiler-rt/lib/gwp_asan/tests/compression.cpp
@@ -11,6 +11,7 @@
namespace gwp_asan {
namespace compression {
+namespace {
TEST(GwpAsanCompressionTest, SingleByteVarInt) {
uint8_t Compressed[1];
@@ -263,5 +264,7 @@ TEST(GwpAsanCompressionTest, CompressPartiallySucceedsWithTooSmallBuffer) {
EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 6u), 5u);
EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 3 * kBytesForLargestVarInt), 5u);
}
+
+} // namespace
} // namespace compression
} // namespace gwp_asan
diff --git a/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp b/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp
index 37a4b384e4ac..6e1ee47d86a5 100644
--- a/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp
+++ b/compiler-rt/lib/gwp_asan/tests/never_allocated.cpp
@@ -12,6 +12,8 @@
#include "gwp_asan/crash_handler.h"
#include "gwp_asan/tests/harness.h"
+#include <unistd.h>
+
TEST_P(BacktraceGuardedPoolAllocatorDeathTest, NeverAllocated) {
size_t PageSize = sysconf(_SC_PAGESIZE);
diff --git a/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp b/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp
index f2a77b094a89..010d29a23382 100644
--- a/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp
+++ b/compiler-rt/lib/gwp_asan/tests/slot_reuse.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include <set>
+
#include "gwp_asan/tests/harness.h"
-#include <set>
+namespace {
void singleByteGoodAllocDealloc(gwp_asan::GuardedPoolAllocator *GPA) {
void *Ptr = GPA->allocate(1);
@@ -72,3 +74,5 @@ TEST_F(CustomGuardedPoolAllocator, NoReuseBeforeNecessary129) {
InitNumSlots(kPoolSize);
runNoReuseBeforeNecessary(&GPA, kPoolSize);
}
+
+} // namespace
diff --git a/compiler-rt/lib/gwp_asan/tests/thread_contention.cpp b/compiler-rt/lib/gwp_asan/tests/thread_contention.cpp
index 26ccd8e60506..311d0c0666b3 100644
--- a/compiler-rt/lib/gwp_asan/tests/thread_contention.cpp
+++ b/compiler-rt/lib/gwp_asan/tests/thread_contention.cpp
@@ -15,6 +15,8 @@
#include <thread>
#include <vector>
+namespace {
+
void asyncTask(gwp_asan::GuardedPoolAllocator *GPA,
std::atomic<bool> *StartingGun, unsigned NumIterations) {
while (!*StartingGun) {
@@ -63,3 +65,5 @@ TEST_F(CustomGuardedPoolAllocator, ThreadContention) {
InitNumSlots(NumThreads);
runThreadContentionTest(NumThreads, NumIterations, &GPA);
}
+
+} // namespace