summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@debian-tkm-01.tmark>2013-06-20 15:39:50 +0200
committerThomas Markwalder <tmark@debian-tkm-01.tmark>2013-06-20 15:39:50 +0200
commit42e6736faa21f98de53a4ac0bc52306041581d91 (patch)
tree6e395e5ba7076a82d509d015efe32304ac4a6e67
parent[2957] This is the second of a two part commit for D2CfgMgr. It Adds a (diff)
downloadkea-42e6736faa21f98de53a4ac0bc52306041581d91.tar.xz
kea-42e6736faa21f98de53a4ac0bc52306041581d91.zip
[2957] Fixed path to dhcp-ddns.spec for spec file unit test, so file
can be located properly. Unit test was failing during distcheck.
-rw-r--r--configure.ac1
-rw-r--r--src/bin/d2/tests/d2_cfg_mgr_unittests.cc8
-rw-r--r--src/bin/d2/tests/test_data_files_config.h.in17
3 files changed, 25 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index fc216c4bab..3b068c6401 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1388,6 +1388,7 @@ AC_OUTPUT([doc/version.ent
src/bin/dhcp4/spec_config.h.pre
src/bin/dhcp6/spec_config.h.pre
src/bin/d2/spec_config.h.pre
+ src/bin/d2/tests/test_data_files_config.h
src/bin/tests/process_rename_test.py
src/lib/config/tests/data_def_unittests_config.h
src/lib/python/isc/config/tests/config_test
diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc
index 77c14bb3d7..6727c12fbe 100644
--- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc
+++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc
@@ -16,6 +16,7 @@
#include <d2/d2_config.h>
#include <d2/d2_cfg_mgr.h>
#include <d_test_stubs.h>
+#include <test_data_files_config.h>
#include <boost/foreach.hpp>
#include <gtest/gtest.h>
@@ -26,6 +27,10 @@ using namespace isc::d2;
namespace {
+std::string specfile(const std::string& name) {
+ return (std::string(D2_SRC_DIR) + "/" + name);
+}
+
/// @brief Test fixture class for testing D2CfgMgr class.
/// It maintains an member instance of D2CfgMgr and provides methods for
/// converting JSON strings to configuration element sets, checking parse
@@ -49,7 +54,8 @@ public:
/// Verifies that the BIND10 DHCP-DDNS configuration specification file
// is valid.
TEST(D2SpecTest, basicSpecTest) {
- ASSERT_NO_THROW(isc::config::moduleSpecFromFile("../dhcp-ddns.spec"));
+ ASSERT_NO_THROW(isc::config::
+ moduleSpecFromFile(specfile("dhcp-ddns.spec")));
}
/// @brief Convenience function which compares the contents of the given
diff --git a/src/bin/d2/tests/test_data_files_config.h.in b/src/bin/d2/tests/test_data_files_config.h.in
new file mode 100644
index 0000000000..6064d3d418
--- /dev/null
+++ b/src/bin/d2/tests/test_data_files_config.h.in
@@ -0,0 +1,17 @@
+// Copyright (C) 2009 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.
+
+/// @brief Path to D2 source dir so tests against the dhcp-ddns.spec file
+/// can find it reliably.
+#define D2_SRC_DIR "@abs_top_srcdir@/src/bin/d2"