[svn] commit: r1710 - in /trunk/src/bin/auth/tests: Makefile.am auth_srv_unittest.cc run_unittests.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Apr 13 23:28:37 UTC 2010
Author: jinmei
Date: Tue Apr 13 23:28:37 2010
New Revision: 1710
Log:
adapted changes on data file specification introduced in r1709.
Modified:
trunk/src/bin/auth/tests/Makefile.am
trunk/src/bin/auth/tests/auth_srv_unittest.cc
trunk/src/bin/auth/tests/run_unittests.cc
Modified: trunk/src/bin/auth/tests/Makefile.am
==============================================================================
--- trunk/src/bin/auth/tests/Makefile.am (original)
+++ trunk/src/bin/auth/tests/Makefile.am Tue Apr 13 23:28:37 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/bin
+AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
CLEANFILES = *.gcno *.gcda
Modified: trunk/src/bin/auth/tests/auth_srv_unittest.cc
==============================================================================
--- trunk/src/bin/auth/tests/auth_srv_unittest.cc (original)
+++ trunk/src/bin/auth/tests/auth_srv_unittest.cc Tue Apr 13 23:28:37 2010
@@ -35,11 +35,12 @@
using namespace isc::data;
namespace {
-const char* CONFIG_TESTDB = "{\"database_file\": \"testdata/example.sqlite3\"}";
+const char* CONFIG_TESTDB =
+ "{\"database_file\": \"" TEST_DATA_DIR "/example.sqlite3\"}";
// The following file must be non existent and must be non"creatable" (see
// the sqlite3 test).
const char* BADCONFIG_TESTDB =
- "{ \"database_file\": \"testdata/nodir/notexist\"}";
+ "{ \"database_file\": \"" TEST_DATA_DIR "/nodir/notexist\"}";
class AuthSrvTest : public ::testing::Test {
protected:
@@ -117,7 +118,7 @@
for (unsigned int i = 1; i < 16; ++i) {
// set Opcode to 'i', which iterators over all possible codes except
// the standard query (0)
- createDataFromFile("testdata/simplequery_fromWire");
+ createDataFromFile("simplequery_fromWire");
data[2] = ((i << 3) & 0xff);
parse_message.clear(Message::PARSE);
@@ -139,7 +140,7 @@
// Multiple questions. Should result in FORMERR.
TEST_F(AuthSrvTest, multiQuestion) {
- createDataFromFile("testdata/multiquestion_fromWire");
+ createDataFromFile("multiquestion_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
headerCheck(parse_message, default_qid, Rcode::FORMERR(), opcode.getCode(),
@@ -160,7 +161,7 @@
// Incoming data doesn't even contain the complete header. Must be silently
// dropped.
TEST_F(AuthSrvTest, shortMessage) {
- createDataFromFile("testdata/shortmessage_fromWire");
+ createDataFromFile("shortmessage_fromWire");
EXPECT_EQ(false, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
}
@@ -169,25 +170,25 @@
// or malformed or could otherwise cause a protocol error.
TEST_F(AuthSrvTest, response) {
// A valid (although unusual) response
- createDataFromFile("testdata/simpleresponse_fromWire");
+ createDataFromFile("simpleresponse_fromWire");
EXPECT_EQ(false, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
// A response with a broken question section. must be dropped rather than
// returning FORMERR.
- createDataFromFile("testdata/shortresponse_fromWire");
+ createDataFromFile("shortresponse_fromWire");
EXPECT_EQ(false, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
// A response to iquery. must be dropped rather than returning NOTIMP.
- createDataFromFile("testdata/iqueryresponse_fromWire");
+ createDataFromFile("iqueryresponse_fromWire");
EXPECT_EQ(false, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
}
// Query with a broken question
TEST_F(AuthSrvTest, shortQuestion) {
- createDataFromFile("testdata/shortquestion_fromWire");
+ createDataFromFile("shortquestion_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
// Since the query's question is broken, the question section of the
@@ -198,7 +199,7 @@
// Query with a broken answer section
TEST_F(AuthSrvTest, shortAnswer) {
- createDataFromFile("testdata/shortanswer_fromWire");
+ createDataFromFile("shortanswer_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
@@ -217,7 +218,7 @@
// Query with unsupported version of EDNS.
TEST_F(AuthSrvTest, ednsBadVers) {
- createDataFromFile("testdata/queryBadEDNS_fromWire");
+ createDataFromFile("queryBadEDNS_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
@@ -251,7 +252,7 @@
// query for existent data in the installed data source. The resulting
// response should have the AA flag on, and have an RR in each answer
// and authority section.
- createDataFromFile("testdata/examplequery_fromWire");
+ createDataFromFile("examplequery_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
headerCheck(parse_message, default_qid, Rcode::NOERROR(), opcode.getCode(),
@@ -265,7 +266,7 @@
// tool and the data source itself naively accept it). This will result
// in a SERVFAIL response, and the answer and authority sections should
// be empty.
- createDataFromFile("testdata/badExampleQuery_fromWire");
+ createDataFromFile("badExampleQuery_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
headerCheck(parse_message, default_qid, Rcode::SERVFAIL(), opcode.getCode(),
@@ -280,7 +281,7 @@
updateConfig(&server, BADCONFIG_TESTDB, false);
// The original data source should still exist.
- createDataFromFile("testdata/examplequery_fromWire");
+ createDataFromFile("examplequery_fromWire");
EXPECT_EQ(true, server.processMessage(*ibuffer, parse_message,
response_renderer, true));
headerCheck(parse_message, default_qid, Rcode::NOERROR(), opcode.getCode(),
Modified: trunk/src/bin/auth/tests/run_unittests.cc
==============================================================================
--- trunk/src/bin/auth/tests/run_unittests.cc (original)
+++ trunk/src/bin/auth/tests/run_unittests.cc Tue Apr 13 23:28:37 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());
}
More information about the bind10-changes
mailing list