[svn] commit: r1713 - in /trunk/src/lib/auth/tests: Makefile.am datasrc_unittest.cc run_unittests.cc sqlite3_unittest.cc test_datasrc.cc unittest_util.cc unittest_util.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Apr 14 18:09:38 UTC 2010
Author: jinmei
Date: Wed Apr 14 18:09:38 2010
New Revision: 1713
Log:
applied the same fix as r1709 and r1710. This will make it possible to run tests in a separate build tree. (trac ticket #143)
also applied the DRY principle to unittest_util*: remove the local copies and simply referred to the dns/tests versions of these files.
Removed:
trunk/src/lib/auth/tests/unittest_util.cc
trunk/src/lib/auth/tests/unittest_util.h
Modified:
trunk/src/lib/auth/tests/Makefile.am
trunk/src/lib/auth/tests/datasrc_unittest.cc
trunk/src/lib/auth/tests/run_unittests.cc
trunk/src/lib/auth/tests/sqlite3_unittest.cc
trunk/src/lib/auth/tests/test_datasrc.cc
Modified: trunk/src/lib/auth/tests/Makefile.am
==============================================================================
--- trunk/src/lib/auth/tests/Makefile.am (original)
+++ trunk/src/lib/auth/tests/Makefile.am Wed Apr 14 18:09:38 2010
@@ -1,5 +1,6 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/lib/dns
+AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
CLEANFILES = *.gcno *.gcda
@@ -7,7 +8,8 @@
if HAVE_GTEST
TESTS += run_unittests
run_unittests_SOURCES = run_unittests.cc
-run_unittests_SOURCES += unittest_util.h unittest_util.cc
+run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.h
+run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.cc
run_unittests_SOURCES += datasrc_unittest.cc
run_unittests_SOURCES += sqlite3_unittest.cc
run_unittests_SOURCES += static_unittest.cc
Modified: trunk/src/lib/auth/tests/datasrc_unittest.cc
==============================================================================
--- trunk/src/lib/auth/tests/datasrc_unittest.cc (original)
+++ trunk/src/lib/auth/tests/datasrc_unittest.cc Wed Apr 14 18:09:38 2010
@@ -38,7 +38,7 @@
#include <auth/sqlite3_datasrc.h>
#include <auth/static_datasrc.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
#include "test_datasrc.h"
using isc::UnitTestUtil;
@@ -50,7 +50,7 @@
namespace {
const ElementPtr SQLITE_DBFILE_EXAMPLE = Element::createFromString(
- "{ \"database_file\": \"testdata/example.org.sqlite3\"}");
+ "{ \"database_file\": \"" TEST_DATA_DIR "/example.org.sqlite3\"}");
class DataSrcTest : public ::testing::Test {
protected:
@@ -192,7 +192,7 @@
}
TEST_F(DataSrcTest, NSQuery) {
- readAndProcessQuery("testdata/q_example_ns");
+ readAndProcessQuery("q_example_ns");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 0, 6);
@@ -214,7 +214,7 @@
}
TEST_F(DataSrcTest, NxRRset) {
- readAndProcessQuery("testdata/q_example_ptr");
+ readAndProcessQuery("q_example_ptr");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 4, 0);
@@ -225,7 +225,7 @@
}
TEST_F(DataSrcTest, Nxdomain) {
- readAndProcessQuery("testdata/q_glork");
+ readAndProcessQuery("q_glork");
headerCheck(msg, Rcode::NXDOMAIN(), true, true, true, 0, 6, 0);
@@ -238,7 +238,7 @@
}
TEST_F(DataSrcTest, NxZone) {
- readAndProcessQuery("testdata/q_spork");
+ readAndProcessQuery("q_spork");
headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
@@ -249,7 +249,7 @@
}
TEST_F(DataSrcTest, Wildcard) {
- readAndProcessQuery("testdata/q_wild_a");
+ readAndProcessQuery("q_wild_a");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 6);
@@ -305,14 +305,14 @@
// Check that a query for a data type not covered by the wildcard
// returns NOERROR
- readAndProcessQuery("testdata/q_wild_aaaa");
+ readAndProcessQuery("q_wild_aaaa");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
}
TEST_F(DataSrcTest, WildcardCname) {
// Check that wildcard answers containing CNAMES are followed
// correctly
- readAndProcessQuery("testdata/q_wild2_a");
+ readAndProcessQuery("q_wild2_a");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 6, 6);
@@ -380,7 +380,7 @@
TEST_F(DataSrcTest, WildcardCnameNodata) {
// A wildcard containing a CNAME whose target does not include
// data of this type.
- readAndProcessQuery("testdata/q_wild2_aaaa");
+ readAndProcessQuery("q_wild2_aaaa");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 0);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -411,7 +411,7 @@
TEST_F(DataSrcTest, WildcardCnameNxdomain) {
// A wildcard containing a CNAME whose target does not exist
- readAndProcessQuery("testdata/q_wild3_a");
+ readAndProcessQuery("q_wild3_a");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 0);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -447,7 +447,7 @@
EXPECT_EQ(RRClass::IN(), rrset->getClass());
}
TEST_F(DataSrcTest, AuthDelegation) {
- readAndProcessQuery("testdata/q_sql1");
+ readAndProcessQuery("q_sql1");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
@@ -493,7 +493,7 @@
}
TEST_F(DataSrcTest, Dname) {
- readAndProcessQuery("testdata/q_dname");
+ readAndProcessQuery("q_dname");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 5, 4, 6);
@@ -541,7 +541,7 @@
}
TEST_F(DataSrcTest, Cname) {
- readAndProcessQuery("testdata/q_cname");
+ readAndProcessQuery("q_cname");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 0, 0);
@@ -559,7 +559,7 @@
}
TEST_F(DataSrcTest, CnameInt) {
- readAndProcessQuery("testdata/q_cname_int");
+ readAndProcessQuery("q_cname_int");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
@@ -585,7 +585,7 @@
}
TEST_F(DataSrcTest, CnameExt) {
- readAndProcessQuery("testdata/q_cname_ext");
+ readAndProcessQuery("q_cname_ext");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
@@ -609,7 +609,7 @@
}
TEST_F(DataSrcTest, Delegation) {
- readAndProcessQuery("testdata/q_subzone");
+ readAndProcessQuery("q_subzone");
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
@@ -639,7 +639,7 @@
}
TEST_F(DataSrcTest, NSDelegation) {
- readAndProcessQuery("testdata/q_subzone_ns");
+ readAndProcessQuery("q_subzone_ns");
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
@@ -671,12 +671,12 @@
TEST_F(DataSrcTest, ANYZonecut) {
// An ANY query at a zone cut should behave the same as any other
// delegation
- readAndProcessQuery("testdata/q_subzone_any");
+ readAndProcessQuery("q_subzone_any");
}
TEST_F(DataSrcTest, NSECZonecut) {
- readAndProcessQuery("testdata/q_subzone_nsec");
+ readAndProcessQuery("q_subzone_nsec");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
@@ -704,7 +704,7 @@
}
TEST_F(DataSrcTest, DNAMEZonecut) {
- readAndProcessQuery("testdata/q_subzone_dname");
+ readAndProcessQuery("q_subzone_dname");
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
@@ -733,7 +733,7 @@
}
TEST_F(DataSrcTest, DS) {
- readAndProcessQuery("testdata/q_subzone_ds");
+ readAndProcessQuery("q_subzone_ds");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 3, 4, 6);
Modified: trunk/src/lib/auth/tests/run_unittests.cc
==============================================================================
--- trunk/src/lib/auth/tests/run_unittests.cc (original)
+++ trunk/src/lib/auth/tests/run_unittests.cc Wed Apr 14 18:09:38 2010
@@ -16,9 +16,13 @@
#include <gtest/gtest.h>
+#include <dns/tests/unittest_util.h>
+
int
main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc, argv);
+ isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
+
return (RUN_ALL_TESTS());
}
Modified: trunk/src/lib/auth/tests/sqlite3_unittest.cc
==============================================================================
--- trunk/src/lib/auth/tests/sqlite3_unittest.cc (original)
+++ trunk/src/lib/auth/tests/sqlite3_unittest.cc Wed Apr 14 18:09:38 2010
@@ -44,13 +44,13 @@
namespace {
ElementPtr SQLITE_DBFILE_EXAMPLE = Element::createFromString(
- "{ \"database_file\": \"testdata/test.sqlite3\"}");
+ "{ \"database_file\": \"" TEST_DATA_DIR "/test.sqlite3\"}");
ElementPtr SQLITE_DBFILE_EXAMPLE2 = Element::createFromString(
- "{ \"database_file\": \"testdata/test2.sqlite3\"}");
+ "{ \"database_file\": \"" TEST_DATA_DIR "/test2.sqlite3\"}");
ElementPtr SQLITE_DBFILE_EXAMPLE_ROOT = Element::createFromString(
- "{ \"database_file\": \"testdata/test-root.sqlite3\"}");
+ "{ \"database_file\": \"" TEST_DATA_DIR "/test-root.sqlite3\"}");
ElementPtr SQLITE_DBFILE_BROKENDB = Element::createFromString(
- "{ \"database_file\": \"testdata/brokendb.sqlite3\"}");
+ "{ \"database_file\": \"" TEST_DATA_DIR "/brokendb.sqlite3\"}");
ElementPtr SQLITE_DBFILE_MEMORY = Element::createFromString(
"{ \"database_file\": \":memory:\"}");
@@ -59,7 +59,7 @@
// so to test a failure case the create operation should also fail.
// The "nodir", a non existent directory, is inserted for this purpose.
ElementPtr SQLITE_DBFILE_NOTEXIST = Element::createFromString(
- "{ \"database_file\": \"testdata/nodir/notexist\"}");
+ "{ \"database_file\": \"" TEST_DATA_DIR "/nodir/notexist\"}");
const string sigdata_common(" 20100322084538 20100220084538 "
"33495 example.com. FAKEFAKEFAKEFAKE");
Modified: trunk/src/lib/auth/tests/test_datasrc.cc
==============================================================================
--- trunk/src/lib/auth/tests/test_datasrc.cc (original)
+++ trunk/src/lib/auth/tests/test_datasrc.cc Wed Apr 14 18:09:38 2010
@@ -18,7 +18,7 @@
#include <cassert>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
#include "test_datasrc.h"
#include <auth/data_source.h>
More information about the bind10-changes
mailing list