[NFC][scudo] Small test cleanup
Fixing issues raised on D102979 review.
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D102994
GitOrigin-RevId: 6435ca4e2b9b4dbdec0b1be65fcacbc0bbdb1d22
diff --git a/tests/common_test.cpp b/tests/common_test.cpp
index 7b35b24..b67acd3 100644
--- a/tests/common_test.cpp
+++ b/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 @@
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 @@
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