]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3056] Skip MemorySegmentMappedTest.badAllocate test when run as the root user
authorMukund Sivaraman <muks@isc.org>
Mon, 15 Jul 2013 14:52:14 +0000 (20:22 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 15 Jul 2013 14:52:14 +0000 (20:22 +0530)
src/lib/util/tests/memory_segment_mapped_unittest.cc

index c22b59e6d5ebde865bb2936b333ab6b9c6f8a4ef..8ae6fea330b9d4875625007a471461bc29b3d220 100644 (file)
@@ -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);