summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Phillips <31459023+hctim@users.noreply.github.com>2023-02-02 15:37:33 -0800
committerCopybara-Service <copybara-worker@google.com>2023-02-02 15:43:12 -0800
commit8b6e1e2483031b819b712d03fb66eb3b7cf8d70d (patch)
tree41f13cc9133c62f687951ce0c99f061bad5c0127
parent0c455c8039265bba5451b398bfc127f6c8fabda6 (diff)
downloadgwp_asan-8b6e1e2483031b819b712d03fb66eb3b7cf8d70d.tar.gz
[GWP-ASan] Remove thread clamping in tests.
It's better and easier for us to just have threads contend against each other in the tests if it's more than the maximum supported number of hardware threads available. Specifically, the recoverable test fails on Android because the GTEST_SKIP in a called function, and it only properly works from the TEST_* harness function. Android tests run on cuttlefish, which can be a single core with two hyperthreads. Reviewed By: fmayer Differential Revision: https://reviews.llvm.org/D143221 GitOrigin-RevId: 10939d1d580b9d3c9c2f3539c6bdb39f408179c0 Change-Id: I455e41a61f8e356d53b396cf05f18888d0bd2f87
-rw-r--r--gwp_asan/tests/recoverable.cpp3
-rw-r--r--gwp_asan/tests/thread_contention.cpp4
2 files changed, 0 insertions, 7 deletions
diff --git a/gwp_asan/tests/recoverable.cpp b/gwp_asan/tests/recoverable.cpp
index a4c5c3f..adc9731 100644
--- a/gwp_asan/tests/recoverable.cpp
+++ b/gwp_asan/tests/recoverable.cpp
@@ -182,9 +182,6 @@ void runInterThreadThrashingSingleAlloc(unsigned NumIterations,
std::atomic<bool> StartingGun{false};
std::vector<std::thread> Threads;
constexpr unsigned kNumThreads = 4;
- if (std::thread::hardware_concurrency() < kNumThreads) {
- GTEST_SKIP() << "Not enough threads to run this test";
- }
char *Ptr = static_cast<char *>(AllocateMemory(*GPA));
diff --git a/gwp_asan/tests/thread_contention.cpp b/gwp_asan/tests/thread_contention.cpp
index 0992b97..26ccd8e 100644
--- a/gwp_asan/tests/thread_contention.cpp
+++ b/gwp_asan/tests/thread_contention.cpp
@@ -44,12 +44,8 @@ void asyncTask(gwp_asan::GuardedPoolAllocator *GPA,
void runThreadContentionTest(unsigned NumThreads, unsigned NumIterations,
gwp_asan::GuardedPoolAllocator *GPA) {
-
std::atomic<bool> StartingGun{false};
std::vector<std::thread> Threads;
- if (std::thread::hardware_concurrency() < NumThreads) {
- NumThreads = std::thread::hardware_concurrency();
- }
for (unsigned i = 0; i < NumThreads; ++i) {
Threads.emplace_back(asyncTask, GPA, &StartingGun, NumIterations);