[PATCH][Review request] MappedMemoryTest: Prevent tests from running if read flag is not set.

The attached patch prevents MappedMemoryTest.BasicWrite and MappedMemoryTest.MultipleWrite (both in unittests/Support/MemoryTest.cpp) from running if the correct protection flags for memory allocation are not set. Without this patch, the two tests fail when I run “make check-all” on a mips octeon board.

The problem with the current code is that it allocates a block of memory without setting the read flag. This results in a segfault at line 115 of MemoryTest.cpp where it reads the allocated block to check whether 1 has been written into the first word of the block. This patch fixes this, and checks that both read and write flags are set.

unittests/Support/MemoryTest.cpp (line 101)

TEST_P(MappedMemoryTest, BasicWrite) {
// This test applies only to writeable combinations
if (Flags && !(Flags & Memory::MF_WRITE))

MemoryBlock M1 = Memory::allocateMappedMemory(sizeof(int), 0, Flags, EC);

int a = (int)M1.base();
*a = 1;
EXPECT_EQ(1, *a); // This line segfaults.


memorytest.patch (1.03 KB)

Look good.


Thanks, committed r169439.