forked from OSchip/llvm-project
[NFC][scudo] Avoid integer overflow in test
releasePagesToOS may shrink RSS below the value stored on start.
This commit is contained in:
parent
1faff79b7c
commit
b40908e639
|
@ -37,16 +37,16 @@ TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
|
|||
MapPlatformData Data = {};
|
||||
void *P = map(nullptr, Size, "ResidentMemorySize", 0, &Data);
|
||||
ASSERT_NE(nullptr, P);
|
||||
EXPECT_LT(getResidentMemorySize() - OnStart, Threshold);
|
||||
EXPECT_LT(getResidentMemorySize(), OnStart + Threshold);
|
||||
|
||||
memset(P, 1, Size);
|
||||
EXPECT_GT(getResidentMemorySize() - OnStart, Size - Threshold);
|
||||
EXPECT_GT(getResidentMemorySize(), OnStart + Size - Threshold);
|
||||
|
||||
releasePagesToOS((uptr)P, 0, Size, &Data);
|
||||
EXPECT_LT(getResidentMemorySize() - OnStart, Threshold);
|
||||
EXPECT_LT(getResidentMemorySize(), OnStart + Threshold);
|
||||
|
||||
memset(P, 1, Size);
|
||||
EXPECT_GT(getResidentMemorySize() - OnStart, Size - Threshold);
|
||||
EXPECT_GT(getResidentMemorySize(), OnStart + Size - Threshold);
|
||||
|
||||
unmap(P, Size, 0, &Data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue