[compiler-rt] 6435ca4 - [NFC][scudo] Small test cleanup

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 10:16:55 PDT 2021


Author: Vitaly Buka
Date: 2021-05-24T10:16:44-07:00
New Revision: 6435ca4e2b9b4dbdec0b1be65fcacbc0bbdb1d22

URL: https://github.com/llvm/llvm-project/commit/6435ca4e2b9b4dbdec0b1be65fcacbc0bbdb1d22
DIFF: https://github.com/llvm/llvm-project/commit/6435ca4e2b9b4dbdec0b1be65fcacbc0bbdb1d22.diff

LOG: [NFC][scudo] Small test cleanup

Fixing issues raised on D102979 review.

Reviewed By: cryptoad

Differential Revision: https://reviews.llvm.org/D102994

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/common_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/common_test.cpp b/compiler-rt/lib/scudo/standalone/tests/common_test.cpp
index 7b35b2494eda..b67acd386189 100644
--- a/compiler-rt/lib/scudo/standalone/tests/common_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/common_test.cpp
@@ -1,4 +1,4 @@
-//===-- common_test.cpp ---------------------------------------*- C++ -*-===//
+//===-- common_test.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.
@@ -16,6 +16,8 @@
 namespace scudo {
 
 static uptr getResidentMemorySize() {
+  if (!SCUDO_LINUX)
+    UNREACHABLE("Not implemented!");
   uptr Size;
   uptr Resident;
   std::ifstream IFS("/proc/self/statm");
@@ -32,7 +34,7 @@ TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
   const uptr Size = 1ull << 30;
   const uptr Threshold = Size >> 3;
 
-  MapPlatformData Data;
+  MapPlatformData Data = {};
   uptr *P = reinterpret_cast<uptr *>(
       map(nullptr, Size, "ResidentMemorySize", 0, &Data));
   const uptr N = Size / sizeof(*P);
@@ -47,12 +49,11 @@ TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
   releasePagesToOS((uptr)P, 0, Size, &Data);
   EXPECT_EQ(std::count(P, P + N, 0), N);
   // FIXME: does not work with QEMU-user.
-  // EXPECT_LT(getResidentMemorySize() - OnStart, Threshold) << OnStart << " "
-  // <<  getResidentMemorySize();
+  // EXPECT_LT(getResidentMemorySize() - OnStart, Threshold);
 
   memset(P, 1, Size);
   EXPECT_EQ(std::count(P, P + N, 0), 0);
   EXPECT_LT(getResidentMemorySize() - Size, Threshold);
 }
 
-} // namespace scudo
\ No newline at end of file
+} // namespace scudo


        


More information about the llvm-commits mailing list