Skip to content

[scudo] Remove ResidentMemorySize test. #145955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions compiler-rt/lib/scudo/standalone/tests/common_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,6 @@

namespace scudo {

static uptr getResidentMemorySize() {
if (!SCUDO_LINUX)
UNREACHABLE("Not implemented!");
uptr Size;
uptr Resident;
std::ifstream IFS("/proc/self/statm");
IFS >> Size;
IFS >> Resident;
return Resident * getPageSizeCached();
}

// Fuchsia needs getResidentMemorySize implementation.
TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
uptr OnStart = getResidentMemorySize();
EXPECT_GT(OnStart, 0UL);

const uptr Size = 1ull << 30;
const uptr Threshold = Size >> 3;

MemMapT MemMap;
ASSERT_TRUE(MemMap.map(/*Addr=*/0U, Size, "ResidentMemorySize"));
ASSERT_NE(MemMap.getBase(), 0U);
void *P = reinterpret_cast<void *>(MemMap.getBase());
EXPECT_LT(getResidentMemorySize(), OnStart + Threshold);

memset(P, 1, Size);
EXPECT_GT(getResidentMemorySize(), OnStart + Size - Threshold);

MemMap.releasePagesToOS(MemMap.getBase(), Size);
EXPECT_LT(getResidentMemorySize(), OnStart + Threshold);

memset(P, 1, Size);
EXPECT_GT(getResidentMemorySize(), OnStart + Size - Threshold);

MemMap.unmap();
}

TEST(ScudoCommonTest, Zeros) {
const uptr Size = 1ull << 20;

Expand Down
Loading