BIND 10 trac2428, updated. 1b7273a397602ebd1d04d692f517941624d89839 [2428] Test popping the source

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Dec 10 18:18:08 UTC 2012


The branch, trac2428 has been updated
       via  1b7273a397602ebd1d04d692f517941624d89839 (commit)
       via  c9bd919bd97e5fd2cf3f50470a29c119bd3b1151 (commit)
      from  e089de85aec2c705d7fee61f1a51e37aa2510756 (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 1b7273a397602ebd1d04d692f517941624d89839
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Dec 10 19:17:59 2012 +0100

    [2428] Test popping the source

commit c9bd919bd97e5fd2cf3f50470a29c119bd3b1151
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Dec 10 19:14:02 2012 +0100

    [2428] Implement basic inclusion

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/master_loader.cc                |   27 +++++++++++++++++++++++----
 src/lib/dns/tests/master_loader_unittest.cc |    9 +++++----
 2 files changed, 28 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index a44fef1..4457e38 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -105,19 +105,38 @@ public:
 
     bool loadIncremental(size_t count_limit);
 
+    void doInclude() {
+        // First, get the filename to include
+        const MasterToken::StringRegion
+            filename(lexer_.getNextToken(MasterLexer::QSTRING).
+                     getStringRegion());
+
+        // TODO: Handle the case where there's Name after the
+        // filename, meaning origin. Once $ORIGIN handling is
+        // done, it should be interconnected somehow.
+
+        // Push the filename. We abuse the fact that filename
+        // may not contain '\0' anywhere in it, so we can
+        // freely use the filename.beg directly.
+        pushSource(filename.beg);
+
+        // TODO: Eat any extra tokens at the end of line (they
+        // should not be here, of course).
+    }
+
     void handleDirective(const char* directive, size_t length) {
         // We use strncasecmp, because there seems to be no reasonable
         // way to compare strings case-insensitive in C++
 
         // Warning: The order of compared strings does matter. The length
         // parameter applies to the first one only.
-        if (strncasecmp(directive, "INCLUDE", length)) {
-
-        } else if (strncasecmp(directive, "ORIGIN", length)) {
+        if (strncasecmp(directive, "INCLUDE", length) == 0) {
+            doInclude();
+        } else if (strncasecmp(directive, "ORIGIN", length) == 0) {
             // TODO: Implement
             isc_throw(isc::NotImplemented,
                       "Origin directive not implemented yet");
-        } else if (strncasecmp(directive, "TTL", length)) {
+        } else if (strncasecmp(directive, "TTL", length) == 0) {
             // TODO: Implement
             isc_throw(isc::NotImplemented,
                       "TTL directive not implemented yet");
diff --git a/src/lib/dns/tests/master_loader_unittest.cc b/src/lib/dns/tests/master_loader_unittest.cc
index ca04b5c..17b221c 100644
--- a/src/lib/dns/tests/master_loader_unittest.cc
+++ b/src/lib/dns/tests/master_loader_unittest.cc
@@ -158,10 +158,10 @@ TEST_F(MasterLoaderTest, include) {
     };
     for (const char** include = includes; *include != NULL; ++include) {
         SCOPED_TRACE(*include);
-        // Prepare input source that has no other content than just the
-        // include of the real master file.
-        const string include_str = string(*include) + " " + TEST_DATA_SRCDIR +
-            "/example.org\n";
+        // Prepare input source that has the include and some more data
+        // below (to see it returns back to the original source).
+        const string include_str = "$" + string(*include) + " " +
+            TEST_DATA_SRCDIR + "/example.org\nwww 3600 IN AAAA 2001:db8::1\n";
         stringstream ss(include_str);
         setLoader(ss, Name("example.org."), RRClass::IN(),
                   MasterLoader::MANY_ERRORS);
@@ -172,6 +172,7 @@ TEST_F(MasterLoaderTest, include) {
         EXPECT_TRUE(warnings_.empty());
 
         checkBasicRRs();
+        checkRR("www.example.org", RRType::AAAA(), "2001:db8::1");
     }
 }
 



More information about the bind10-changes mailing list