Commit 2500db66 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] avoid compile mapped-segment dependent code if !USE_SHARED_MEMORY

okayed on jabber.
parent 45d2c5e0
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
#include <dns/name.h> #include <dns/name.h>
#include <dns/rrclass.h> #include <dns/rrclass.h>
#include <dns/rdataclass.h> #include <dns/rdataclass.h>
#ifdef USE_SHARED_MEMORY
#include <util/memory_segment_mapped.h> #include <util/memory_segment_mapped.h>
#endif
#include <util/memory_segment_local.h> #include <util/memory_segment_local.h>
#include <datasrc/tests/memory/memory_segment_mock.h> #include <datasrc/tests/memory/memory_segment_mock.h>
...@@ -33,13 +35,13 @@ ...@@ -33,13 +35,13 @@
using namespace isc::dns; using namespace isc::dns;
using namespace isc::datasrc::memory; using namespace isc::datasrc::memory;
#ifdef USE_SHARED_MEMORY
using isc::util::MemorySegmentMapped; using isc::util::MemorySegmentMapped;
#endif
using isc::datasrc::memory::detail::SegmentObjectHolder; using isc::datasrc::memory::detail::SegmentObjectHolder;
namespace { namespace {
const char* const mapped_file = TEST_DATA_BUILDDIR "/test.mapped";
class ZoneDataLoaderTest : public ::testing::Test { class ZoneDataLoaderTest : public ::testing::Test {
protected: protected:
ZoneDataLoaderTest() : zclass_(RRClass::IN()), zone_data_(NULL) {} ZoneDataLoaderTest() : zclass_(RRClass::IN()), zone_data_(NULL) {}
...@@ -84,7 +86,10 @@ TEST_F(ZoneDataLoaderTest, zoneMinTTL) { ...@@ -84,7 +86,10 @@ TEST_F(ZoneDataLoaderTest, zoneMinTTL) {
// Load bunch of small zones, hoping some of the relocation will happen // Load bunch of small zones, hoping some of the relocation will happen
// during the memory creation, not only Rdata creation. // during the memory creation, not only Rdata creation.
// Note: this doesn't even compile unless USE_SHARED_MEMORY is defined.
#ifdef USE_SHARED_MEMORY
TEST(ZoneDataLoaterTest, relocate) { TEST(ZoneDataLoaterTest, relocate) {
const char* const mapped_file = TEST_DATA_BUILDDIR "/test.mapped";
MemorySegmentMapped segment(mapped_file, MemorySegmentMapped segment(mapped_file,
isc::util::MemorySegmentMapped::CREATE_ONLY, isc::util::MemorySegmentMapped::CREATE_ONLY,
4096); 4096);
...@@ -108,5 +113,6 @@ TEST(ZoneDataLoaterTest, relocate) { ...@@ -108,5 +113,6 @@ TEST(ZoneDataLoaterTest, relocate) {
EXPECT_TRUE(segment.allMemoryDeallocated()); EXPECT_TRUE(segment.allMemoryDeallocated());
EXPECT_EQ(0, unlink(mapped_file)); EXPECT_EQ(0, unlink(mapped_file));
} }
#endif
} }
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