[compiler-rt] 56a9eff - [scudo] Skip AllocAfterFork test on machines with low max_map_count
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 10:33:57 PDT 2021
Author: Kostya Kortchinsky
Date: 2021-10-11T10:33:47-07:00
New Revision: 56a9effc427b10203dfb7f691a12924a82ba5cd5
URL: https://github.com/llvm/llvm-project/commit/56a9effc427b10203dfb7f691a12924a82ba5cd5
DIFF: https://github.com/llvm/llvm-project/commit/56a9effc427b10203dfb7f691a12924a82ba5cd5.diff
LOG: [scudo] Skip AllocAfterFork test on machines with low max_map_count
Reducing the number of iterations in that test with D111342 helped,
but the failure still occured flakily when the test is ran as part
of a large test suite.
Reducing further the number of iterations might not be good enough,
so we will skip the test if the `max_map_count` variable can be
read, and if lower than a given threshold.
Differential Revision: https://reviews.llvm.org/D111465
Added:
Modified:
compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
index 5099e6d9d5ed3..a88dc4aacd57f 100644
--- a/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
@@ -11,6 +11,7 @@
#include <atomic>
#include <condition_variable>
+#include <fstream>
#include <memory>
#include <mutex>
#include <thread>
@@ -131,6 +132,22 @@ TEST(ScudoWrappersCppTest, ThreadedNew) {
#if !SCUDO_FUCHSIA
TEST(ScudoWrappersCppTest, AllocAfterFork) {
+ // This test can fail flakily when ran as a part of large number of
+ // other tests if the maxmimum number of mappings allowed is low.
+ // We tried to reduce the number of iterations of the loops with
+ // moderate success, so we will now skip this test under those
+ // circumstances.
+ if (SCUDO_LINUX) {
+ long MaxMapCount = 0;
+ // If the file can't be accessed, we proceed with the test.
+ std::ifstream Stream("/proc/sys/vm/max_map_count");
+ if (Stream.good()) {
+ Stream >> MaxMapCount;
+ if (MaxMapCount < 200000)
+ return;
+ }
+ }
+
std::atomic_bool Stop;
// Create threads that simply allocate and free
diff erent sizes.
More information about the llvm-commits
mailing list