[PATCH] D111465: [scudo] Skip AllocAfterFork test on machines with low max_map_count

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 8 14:16:40 PDT 2021


cryptoad updated this revision to Diff 378359.
cryptoad added a comment.
Herald added a subscriber: ormris.

... and remove local debugging line.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111465/new/

https://reviews.llvm.org/D111465

Files:
  compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp


Index: compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
+++ 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 @@
 
 #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 different sizes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111465.378359.patch
Type: text/x-patch
Size: 1183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211008/27717505/attachment.bin>


More information about the llvm-commits mailing list