From: Mukund Sivaraman Date: Mon, 15 Jul 2013 14:52:14 +0000 (+0530) Subject: [3056] Skip MemorySegmentMappedTest.badAllocate test when run as the root user X-Git-Tag: bind10-1.2.0beta1-release~337^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c1f096e54e42bb79fec8a28abc6528b3c5fc857;p=thirdparty%2Fkea.git [3056] Skip MemorySegmentMappedTest.badAllocate test when run as the root user --- diff --git a/src/lib/util/tests/memory_segment_mapped_unittest.cc b/src/lib/util/tests/memory_segment_mapped_unittest.cc index c22b59e6d5..8ae6fea330 100644 --- a/src/lib/util/tests/memory_segment_mapped_unittest.cc +++ b/src/lib/util/tests/memory_segment_mapped_unittest.cc @@ -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);