Browse Source

[2957] Fixed path to dhcp-ddns.spec for spec file unit test, so file
can be located properly. Unit test was failing during distcheck.

Thomas Markwalder 12 years ago
parent
commit
42e6736faa

+ 1 - 0
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

+ 7 - 1
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

+ 17 - 0
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"