Parcourir la source

Merge branch 'master' of ssh://bind10.isc.org/var/bind10/git/bind10

zhanglikun il y a 14 ans
Parent
commit
9890869053

+ 2 - 0
src/lib/cache/message_cache.cc

@@ -14,6 +14,8 @@
 
 // $Id$
 
+#include <config.h>
+
 #include <nsas/nsas_entry_compare.h>
 #include <nsas/hash_table.h>
 #include <nsas/hash_deleter.h>

+ 2 - 0
src/lib/cache/message_entry.cc

@@ -14,6 +14,8 @@
 
 // $Id$
 
+#include <config.h>
+
 #include <limits>
 #include <dns/message.h>
 #include <nsas/nsas_entry.h>

+ 2 - 0
src/lib/cache/resolver_cache.cc

@@ -14,6 +14,8 @@
 
 // $Id$
 
+#include <config.h>
+
 #include "resolver_cache.h"
 #include "dns/message.h"
 #include "rrset_cache.h"

+ 2 - 0
src/lib/cache/rrset_cache.cc

@@ -14,6 +14,8 @@
 
 // $Id$
 
+#include <config.h>
+
 #include <string>
 #include "rrset_cache.h"
 #include <nsas/nsas_entry_compare.h>

+ 2 - 0
src/lib/cache/rrset_entry.cc

@@ -14,6 +14,8 @@
 
 // $Id$
 
+#include <config.h>
+
 #include <dns/message.h>
 #include <nsas/nsas_entry.h>
 #include <nsas/fetchable.h>

+ 9 - 0
src/lib/cache/tests/Makefile.am

@@ -38,6 +38,8 @@ run_unittests_SOURCES  += message_cache_unittest.cc
 run_unittests_SOURCES  += message_entry_unittest.cc
 run_unittests_SOURCES  += local_zone_data_unittest.cc
 run_unittests_SOURCES  += resolver_cache_unittest.cc
+run_unittests_SOURCES  += cache_test_messagefromfile.h
+run_unittests_SOURCES  += cache_test_sectioncount.h
 
 run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
@@ -55,3 +57,10 @@ run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
 endif
 
 noinst_PROGRAMS = $(TESTS)
+
+EXTRA_DIST = testdata/message_fromWire1
+EXTRA_DIST += testdata/message_fromWire2
+EXTRA_DIST += testdata/message_fromWire3
+EXTRA_DIST += testdata/message_fromWire4
+EXTRA_DIST += testdata/message_fromWire5
+EXTRA_DIST += testdata/message_fromWire6

+ 40 - 0
src/lib/cache/tests/cache_test_messagefromfile.h

@@ -0,0 +1,40 @@
+// Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+// $Id$
+#include <vector>
+#include <dns/tests/unittest_util.h>
+#include <dns/buffer.h>
+#include <dns/message.h>
+
+using namespace isc;
+using namespace isc::dns;
+
+namespace {
+
+/// \brief Reads a Message from a data file
+///
+/// \param message Message to put the read data in
+/// \param datafile The file to read from
+void
+messageFromFile(Message& message, const char* datafile) {
+    std::vector<unsigned char> data;
+    UnitTestUtil::readWireData(datafile, data);
+
+    InputBuffer buffer(&data[0], data.size());
+    message.fromWire(buffer);
+}
+
+}   // namespace
+

+ 0 - 13
src/lib/cache/tests/cache_test_util.h

@@ -23,19 +23,6 @@ using namespace isc::dns;
 
 namespace {
 
-/// \brief Reads a Message from a data file
-///
-/// \param message Message to put the read data in
-/// \param datafile The file to read from
-void
-messageFromFile(Message& message, const char* datafile) {
-    std::vector<unsigned char> data;
-    UnitTestUtil::readWireData(datafile, data);
-
-    InputBuffer buffer(&data[0], data.size());
-    message.fromWire(buffer);
-}
-
 /// \brief Counts the number of rrsets in the given section
 ///
 /// \param msg The message to count in

+ 1 - 1
src/lib/cache/tests/local_zone_data_unittest.cc

@@ -19,7 +19,7 @@
 #include <cache/local_zone_data.h>
 #include <dns/rrset.h>
 #include <dns/rrttl.h>
-#include "cache_test_util.h"
+#include "cache_test_messagefromfile.h"
 
 using namespace isc::cache;
 using namespace isc::dns;

+ 2 - 2
src/lib/cache/tests/message_cache_unittest.cc

@@ -21,7 +21,7 @@
 #include "../message_cache.h"
 #include "../rrset_cache.h"
 #include "../resolver_cache.h"
-#include "cache_test_util.h"
+#include "cache_test_messagefromfile.h"
 
 using namespace isc::cache;
 using namespace isc;
@@ -78,7 +78,7 @@ TEST_F(MessageCacheTest, testLookup) {
     EXPECT_TRUE(message_cache_->lookup(qname1, RRType::A(), message_render));
 }
 
-TEST_F(MessageCacheTest, testUpdate) {
+TEST_F(MessageCacheTest, DISABLED_testUpdate) {
     messageFromFile(message_parse, "message_fromWire4");
     EXPECT_TRUE(message_cache_->update(message_parse));
 

+ 2 - 1
src/lib/cache/tests/message_entry_unittest.cc

@@ -22,7 +22,8 @@
 #include "../message_entry.h"
 #include "../rrset_cache.h"
 #include "../resolver_cache.h"
-#include "cache_test_util.h"
+#include "cache_test_messagefromfile.h"
+#include "cache_test_sectioncount.h"
 
 using namespace isc::cache;
 using namespace isc;

+ 1 - 1
src/lib/cache/tests/resolver_cache_unittest.cc

@@ -18,7 +18,7 @@
 #include <gtest/gtest.h>
 #include <dns/rrset.h>
 #include "resolver_cache.h"
-#include "cache_test_util.h"
+#include "cache_test_messagefromfile.h"
 
 using namespace isc::cache;
 using namespace isc::dns;

+ 1 - 0
src/lib/cache/tests/rrset_entry_unittest.cc

@@ -49,6 +49,7 @@ TEST_F(GenCacheKeyTest, genCacheEntryKey2) {
 
 class DerivedRRsetEntry: public RRsetEntry {
 public:
+    DerivedRRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level) : RRsetEntry(rrset, level) {};
 
     void updateTTLForTest() {