BIND 10 trac2836, updated. 423740919b7a050dc1255a0ebdc6ab6b71ea777f [2836] Attempt a test for whole zone loading
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon May 13 13:09:17 UTC 2013
The branch, trac2836 has been updated
via 423740919b7a050dc1255a0ebdc6ab6b71ea777f (commit)
from f0229b977d354a137df49137655eb3ec56d96f97 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 423740919b7a050dc1255a0ebdc6ab6b71ea777f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon May 13 15:00:51 2013 +0200
[2836] Attempt a test for whole zone loading
Attempt to write a test that loads a bunch of zones, probably causing a
relocation.
However, it currently crashes and does so before the relocation happens,
which is strange. It does not crash with the local segment, only with
the mapped, which is stranger.
-----------------------------------------------------------------------
Summary of changes:
.../tests/memory/zone_data_loader_unittest.cc | 36 ++++++++++++++++++++
1 file changed, 36 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/memory/zone_data_loader_unittest.cc b/src/lib/datasrc/tests/memory/zone_data_loader_unittest.cc
index abc6f13..a9aaea3 100644
--- a/src/lib/datasrc/tests/memory/zone_data_loader_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_data_loader_unittest.cc
@@ -16,11 +16,16 @@
#include <datasrc/memory/rdataset.h>
#include <datasrc/memory/zone_data.h>
#include <datasrc/memory/zone_data_updater.h>
+#include <datasrc/memory/segment_object_holder.h>
+#include <datasrc/zone_iterator.h>
#include <util/buffer.h>
#include <dns/name.h>
#include <dns/rrclass.h>
+#include <dns/rdataclass.h>
+#include <util/memory_segment_mapped.h>
+#include <util/memory_segment_local.h>
#include "memory_segment_test.h"
@@ -28,9 +33,13 @@
using namespace isc::dns;
using namespace isc::datasrc::memory;
+using isc::util::MemorySegmentMapped;
+using isc::datasrc::memory::detail::SegmentObjectHolder;
namespace {
+const char* const mapped_file = TEST_DATA_BUILDDIR "/test.mapped";
+
class ZoneDataLoaderTest : public ::testing::Test {
protected:
ZoneDataLoaderTest() : zclass_(RRClass::IN()), zone_data_(NULL) {}
@@ -73,4 +82,31 @@ TEST_F(ZoneDataLoaderTest, zoneMinTTL) {
EXPECT_EQ(RRTTL(1200), RRTTL(b));
}
+// Load bunch of small zones, hoping some of the relocation will happen
+// during the memory creation, not only Rdata creation.
+TEST(ZoneDataLoaterTest, relocate) {
+ MemorySegmentMapped segment(mapped_file,
+ isc::util::MemorySegmentMapped::CREATE_ONLY,
+ 4096);
+ const size_t zone_count = 10000;
+ typedef SegmentObjectHolder<ZoneData, RRClass> Holder;
+ typedef boost::shared_ptr<Holder> HolderPtr;
+ std::vector<HolderPtr> zones;
+ for (size_t i = 0; i < zone_count; ++i) {
+ // Load some zone
+ ZoneData* data = loadZoneData(segment, RRClass::IN(),
+ Name("example.org"),
+ TEST_DATA_DIR
+ "/example.org-nsec3-signed.zone");
+ // Store it, so it is cleaned up later
+ zones.push_back(HolderPtr(new Holder(segment, data,
+ RRClass::IN())));
+
+ }
+ // Deallocate all the zones now.
+ zones.clear();
+ EXPECT_TRUE(segment.allMemoryDeallocated());
+ EXPECT_EQ(0, unlink(mapped_file));
+}
+
}
More information about the bind10-changes
mailing list