Commit 3c1f096e authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[3056] Skip MemorySegmentMappedTest.badAllocate test when run as the root user

parent 56393640
......@@ -237,6 +237,15 @@ TEST_F(MemorySegmentMappedTest, allocate) {
}
TEST_F(MemorySegmentMappedTest, badAllocate) {
// If the test is run as the root user, the following allocate()
// call will result in a successful MemorySegmentGrown exception,
// instead of an abort (due to insufficient permissions during
// reopen).
if (getuid() == 0) {
std::cerr << "Skipping test as it's run as the root user" << std::endl;
return;
}
// Make the mapped file non-writable; managed_mapped_file::grow() will
// fail, resulting in abort.
const int ret = chmod(mapped_file, 0444);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment