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.<br>
<br>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. <br>
<br><br>unittests/Support/MemoryTest.cpp (line 101)<br><br>
TEST_P(MappedMemoryTest, BasicWrite) {<br>
// This test applies only to writeable combinations<br>
if (Flags && !(Flags & Memory::MF_WRITE))<br>
return;<br>
<br>
MemoryBlock M1 = Memory::allocateMappedMemory(sizeof(int), 0, Flags, EC);<br>
...<br>
int *a = (int*)M1.base();<br>
*a = 1;<br>
EXPECT_EQ(1, *a); // This line segfaults.<br>
...<br>
}<br>
<br>