Fix a few warnings (signed/unsigned comparison in gtest, and missing field initializers)

This commit is contained in:
David Blaikie 2021-10-16 22:43:57 -07:00
parent 40b9c39db1
commit 6176fda3f9
2 changed files with 31 additions and 31 deletions

View File

@ -34,81 +34,81 @@ public:
// numerics of the testing.
TEST(AlignmentTest, LeftAlignedAllocs) {
// Alignment < Page Size.
EXPECT_EQ(0x4000, AlignmentTestGPA::alignUp(
EXPECT_EQ(0x4000u, AlignmentTestGPA::alignUp(
/* Ptr */ 0x4000, /* Alignment */ 0x1));
// Alignment == Page Size.
EXPECT_EQ(0x4000, AlignmentTestGPA::alignUp(
EXPECT_EQ(0x4000u, AlignmentTestGPA::alignUp(
/* Ptr */ 0x4000, /* Alignment */ 0x1000));
// Alignment > Page Size.
EXPECT_EQ(0x4000, AlignmentTestGPA::alignUp(
EXPECT_EQ(0x4000u, AlignmentTestGPA::alignUp(
/* Ptr */ 0x4000, /* Alignment */ 0x4000));
}
TEST(AlignmentTest, SingleByteAllocs) {
// Alignment < Page Size.
EXPECT_EQ(0x1,
EXPECT_EQ(0x1u,
AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x1, /* Alignment */ 0x1, /* PageSize */ 0x1000));
EXPECT_EQ(0x7fff, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x7fffu, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x1, /* Alignment */ 0x1));
// Alignment == Page Size.
EXPECT_EQ(0x1,
EXPECT_EQ(0x1u,
AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x1, /* Alignment */ 0x1000, /* PageSize */ 0x1000));
EXPECT_EQ(0x7000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x7000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x1, /* Alignment */ 0x1000));
// Alignment > Page Size.
EXPECT_EQ(0x3001,
EXPECT_EQ(0x3001u,
AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x1, /* Alignment */ 0x4000, /* PageSize */ 0x1000));
EXPECT_EQ(0x4000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x4000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x1, /* Alignment */ 0x4000));
}
TEST(AlignmentTest, PageSizedAllocs) {
// Alignment < Page Size.
EXPECT_EQ(0x1000,
EXPECT_EQ(0x1000u,
AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x1000, /* Alignment */ 0x1, /* PageSize */ 0x1000));
EXPECT_EQ(0x7000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x7000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x1000, /* Alignment */ 0x1));
// Alignment == Page Size.
EXPECT_EQ(0x1000, AlignmentTestGPA::getRequiredBackingSize(
EXPECT_EQ(0x1000u, AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x1000, /* Alignment */ 0x1000,
/* PageSize */ 0x1000));
EXPECT_EQ(0x7000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x7000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x1000, /* Alignment */ 0x1000));
// Alignment > Page Size.
EXPECT_EQ(0x4000, AlignmentTestGPA::getRequiredBackingSize(
EXPECT_EQ(0x4000u, AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x1000, /* Alignment */ 0x4000,
/* PageSize */ 0x1000));
EXPECT_EQ(0x4000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x4000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x1000, /* Alignment */ 0x4000));
}
TEST(AlignmentTest, MoreThanPageAllocs) {
// Alignment < Page Size.
EXPECT_EQ(0x2fff,
EXPECT_EQ(0x2fffu,
AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x2fff, /* Alignment */ 0x1, /* PageSize */ 0x1000));
EXPECT_EQ(0x5001, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x5001u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x2fff, /* Alignment */ 0x1));
// Alignment == Page Size.
EXPECT_EQ(0x2fff, AlignmentTestGPA::getRequiredBackingSize(
EXPECT_EQ(0x2fffu, AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x2fff, /* Alignment */ 0x1000,
/* PageSize */ 0x1000));
EXPECT_EQ(0x5000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x5000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x2fff, /* Alignment */ 0x1000));
// Alignment > Page Size.
EXPECT_EQ(0x5fff, AlignmentTestGPA::getRequiredBackingSize(
EXPECT_EQ(0x5fffu, AlignmentTestGPA::getRequiredBackingSize(
/* Size */ 0x2fff, /* Alignment */ 0x4000,
/* PageSize */ 0x1000));
EXPECT_EQ(0x4000, AlignmentTestGPA::alignDown(
EXPECT_EQ(0x4000u, AlignmentTestGPA::alignDown(
/* Ptr */ 0x8000 - 0x2fff, /* Alignment */ 0x4000));
}

View File

@ -130,22 +130,22 @@ static struct StackDepotBenchmarkParams {
bool UseCount;
} params[] = {
// All traces are unique, very unusual.
{10000000, 1, 1},
{8000000, 1, 4},
{8000000, 1, 16},
{10000000, 1, 1, false, false},
{8000000, 1, 4, false, false},
{8000000, 1, 16, false, false},
// Probably most realistic sets.
{3000000, 10, 1},
{3000000, 10, 4},
{3000000, 10, 16},
{3000000, 10, 1, false, false},
{3000000, 10, 4, false, false},
{3000000, 10, 16, false, false},
// Update use count as msan/dfsan.
{3000000, 10, 1, false, true},
{3000000, 10, 4, false, true},
{3000000, 10, 16, false, true},
// Unrealistic, as above, but traces are unique inside of thread.
{4000000, 1, 4, true},
{2000000, 1, 16, true},
{2000000, 10, 4, true},
{500000, 10, 16, true},
{4000000, 1, 4, true, false},
{2000000, 1, 16, true, false},
{2000000, 10, 4, true, false},
{500000, 10, 16, true, false},
{1500000, 10, 4, true, true},
{800000, 10, 16, true, true},
};