BIND 10 trac2836, updated. a752e1aeacc9470ff3dfb172bf3f9064eefc3161 [2836] Test growth of the mapped segment
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu May 2 14:11:13 UTC 2013
The branch, trac2836 has been updated
via a752e1aeacc9470ff3dfb172bf3f9064eefc3161 (commit)
from d42136528ea0edc6c7ea45c3c4d4c542217f9d33 (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 a752e1aeacc9470ff3dfb172bf3f9064eefc3161
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Thu May 2 16:04:13 2013 +0200
[2836] Test growth of the mapped segment
Fill the memory image with a lot of records, so the segment must grow.
Currently fails, because the growth is not handled.
-----------------------------------------------------------------------
Summary of changes:
.../tests/memory/zone_data_updater_unittest.cc | 46 +++++++++++++++-----
1 file changed, 36 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/memory/zone_data_updater_unittest.cc b/src/lib/datasrc/tests/memory/zone_data_updater_unittest.cc
index ae18246..78cfc54 100644
--- a/src/lib/datasrc/tests/memory/zone_data_updater_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_data_updater_unittest.cc
@@ -33,6 +33,7 @@
#include <gtest/gtest.h>
#include <boost/scoped_ptr.hpp>
+#include <boost/lexical_cast.hpp>
#include <cassert>
@@ -56,6 +57,16 @@ public:
virtual void cleanup() const {};
};
+ZoneNode*
+getNode(isc::util::MemorySegment& mem_sgmt, const Name& name,
+ ZoneData* zone_data)
+{
+ ZoneNode* node = NULL;
+ zone_data->insertName(mem_sgmt, name, &node);
+ EXPECT_NE(static_cast<ZoneNode*>(NULL), node);
+ return (node);
+}
+
class ZoneDataUpdaterTest : public ::testing::TestWithParam<SegmentCreator*> {
protected:
ZoneDataUpdaterTest() :
@@ -149,16 +160,6 @@ TEST_P(ZoneDataUpdaterTest, bothNull) {
ZoneDataUpdater::NullRRset);
}
-ZoneNode*
-getNode(isc::util::MemorySegment& mem_sgmt, const Name& name,
- ZoneData* zone_data)
-{
- ZoneNode* node = NULL;
- zone_data->insertName(mem_sgmt, name, &node);
- EXPECT_NE(static_cast<ZoneNode*>(NULL), node);
- return (node);
-}
-
TEST_P(ZoneDataUpdaterTest, zoneMinTTL) {
// If we add SOA, zone's min TTL will be updated.
updater_->add(textToRRset(
@@ -286,4 +287,29 @@ TEST_P(ZoneDataUpdaterTest, rrsigForNSEC3Only) {
isc::NotImplemented);
}
+// Generate many small RRsets. This tests that the underlying memory segment
+// can grow during the execution and that the updater handles that well.
+//
+// Some of the grows will happen inserting the RRSIG, some with the TXT.
+TEST_P(ZoneDataUpdaterTest, manySmallRRsets) {
+ for (size_t i = 0; i < 32768; ++i) {
+ const std::string name(boost::lexical_cast<std::string>(i) +
+ ".example.org.");
+ updater_->add(textToRRset(name + " 3600 IN TXT " +
+ std::string(30, 'X')),
+ textToRRset(name + " 3600 IN RRSIG TXT 5 3 3600 "
+ "20150420235959 20051021000000 1 "
+ "example.org. FAKE"));
+ ZoneNode* node = getNode(*mem_sgmt_,
+ Name(boost::lexical_cast<std::string>(i) +
+ ".example.org"), zone_data_);
+ const RdataSet* rdset = node->getData();
+ ASSERT_NE(static_cast<RdataSet*>(NULL), rdset);
+ rdset = RdataSet::find(rdset, RRType::TXT(), true);
+ ASSERT_NE(static_cast<RdataSet*>(NULL), rdset);
+ EXPECT_EQ(1, rdset->getRdataCount());
+ EXPECT_EQ(1, rdset->getSigRdataCount());
+ }
+}
+
}
More information about the bind10-changes
mailing list