Commit 054dceda authored by Jeremy C. Reed's avatar Jeremy C. Reed
Browse files

Merged in from trunk to catch up.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac316@2798 e5f2f494-b856-4b98-b285-d166d9295462
parents f36fcb5c 35433512
90. [build] jinmei
(Darwin/Mac OS X specific) Specify DYLD_LIBRARY_PATH for tests and
experimental run under the source tree. Without this loadable
python modules refer to installation paths, which may confuse the
operation due to version mismatch or even trigger run time errors
due to missing libraries. (Trac #313, r2782)
89. [build] jinmei
Generate b10-config.db for tests at build time so that the source
tree does not have to be writable. (Trac #315, r2776)
88. [func] jelte
Blocking reads on the msgq command channel now have a timeout
(defaults to 4 seconds, modifiable as needed by modules).
......
......@@ -40,14 +40,30 @@ AC_HELP_STRING([--enable-static-link],
[enable_static_link=yes], [enable_static_link=no])
AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
# OS dependent compiler flags
# OS dependent configuration
SET_ENV_LIBRARY_PATH=no
ENV_LIBRARY_PATH=LD_LIBRARY_PATH
case "$host" in
*-solaris*)
# Solaris requires special definitions to get some standard libraries
# (e.g. getopt(3)) available with common used header files.
CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
;;
*-apple-darwin*)
# libtool doesn't work pefectly with Darwin: libtool embeds the
# final install path in dynamic libraries and our loadable python
# modules always refer to that path even if it's loaded within the
# source tree. This prevents pre-install tests from working.
# To work around this problem we explicitly specify paths to dynamic
# libraries when we use them in the source tree.
SET_ENV_LIBRARY_PATH=yes
ENV_LIBRARY_PATH=DYLD_LIBRARY_PATH
;;
esac
AM_CONDITIONAL(SET_ENV_LIBRARY_PATH, test $SET_ENV_LIBRARY_PATH = yes)
AC_SUBST(SET_ENV_LIBRARY_PATH)
AC_SUBST(ENV_LIBRARY_PATH)
m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3 python3.1])
AC_ARG_WITH([pythonpath],
......@@ -433,6 +449,7 @@ AC_CONFIG_FILES([Makefile
src/lib/python/isc/notify/tests/Makefile
src/lib/config/Makefile
src/lib/config/tests/Makefile
src/lib/config/testdata/Makefile
src/lib/dns/Makefile
src/lib/dns/tests/Makefile
src/lib/dns/python/Makefile
......
......@@ -207,7 +207,7 @@ public:
/// will be thrown.
///
/// Memory for the created object will be dynamically allocated. It's
/// caller's responsibility to \c delete it later.
/// the caller's responsibility to \c delete it later.
/// If resource allocation for the new object fails, a corresponding
/// standard exception will be thrown.
///
......
......@@ -18,7 +18,7 @@
"""\
This file implements the Boss of Bind (BoB, or bob) program.
It's purpose is to start up the BIND 10 system, and then manage the
Its purpose is to start up the BIND 10 system, and then manage the
processes, by starting and stopping processes, plus restarting
processes that exit.
......
......@@ -24,9 +24,16 @@ PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_bu
export PATH
PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs
#PYTHONPATH=@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/.libs:@abs_top_builddir@/src/lib/xfr/.libs
export PYTHONPATH
# If necessary (rare cases), explicitly specify paths to dynamic libraries
# required by loadable python modules.
SET_ENV_LIBRARY_PATH=@SET_ENV_LIBRARY_PATH@
if test $SET_ENV_LIBRARY_PATH = yes; then
@ENV_LIBRARY_PATH@=@abs_top_builddir@/src/lib/dns/.libs:@abs_top_builddir@/src/lib/exceptions/.libs:$@ENV_LIBRARY_PATH@
export @ENV_LIBRARY_PATH@
fi
B10_FROM_SOURCE=@abs_top_srcdir@
export B10_FROM_SOURCE
# TODO: We need to do this feature based (ie. no general from_source)
......
PYTESTS = xfrin_test.py
EXTRA_DIST = $(PYTESTS)
# If necessary (rare cases), explicitly specify paths to dynamic libraries
# required by loadable python modules.
LIBRARY_PATH_PLACEHOLDER =
if SET_ENV_LIBRARY_PATH
LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/xfr/.libs:$$$(ENV_LIBRARY_PATH)
endif
# later will have configure option to choose this, like: coverage run --branch
PYCOVERAGE = $(PYTHON)
# test using command-line arguments, so use check-local target instead of TESTS
......@@ -8,5 +15,6 @@ check-local:
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
$(LIBRARY_PATH_PLACEHOLDER) \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest || exit ; \
done
......@@ -559,7 +559,7 @@ def raise_interrupt():
def raise_ccerror():
raise isc.cc.session.SessionError('test error')
def raise_excpetion():
def raise_exception():
raise Exception('test exception')
class TestMain(unittest.TestCase):
......@@ -581,7 +581,7 @@ class TestMain(unittest.TestCase):
main(MockXfrin, False)
def test_startup_generalerror(self):
MockXfrin.check_command_hook = raise_excpetion
MockXfrin.check_command_hook = raise_exception
main(MockXfrin, False)
if __name__== "__main__":
......
PYTESTS = xfrout_test.py
EXTRA_DIST = $(PYTESTS)
# If necessary (rare cases), explicitly specify paths to dynamic libraries
# required by loadable python modules.
LIBRARY_PATH_PLACEHOLDER =
if SET_ENV_LIBRARY_PATH
LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/xfr/.libs:$$$(ENV_LIBRARY_PATH)
endif
# later will have configure option to choose this, like: coverage run --branch
PYCOVERAGE = $(PYTHON)
# test using command-line arguments, so use check-local target instead of TESTS
......@@ -8,5 +15,6 @@ check-local:
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \
$(LIBRARY_PATH_PLACEHOLDER) \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest || exit ; \
done
SUBDIRS = . tests
SUBDIRS = . testdata tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
......@@ -13,7 +13,7 @@ EXTRA_DIST = testdata/b10-config-bad1.db
EXTRA_DIST += testdata/b10-config-bad2.db
EXTRA_DIST += testdata/b10-config-bad3.db
EXTRA_DIST += testdata/b10-config-bad4.db
EXTRA_DIST += testdata/b10-config.db
EXTRA_DIST += testdata/b10-config.db.master #.db will be auto-generated
EXTRA_DIST += testdata/data22_1.data
EXTRA_DIST += testdata/data22_2.data
EXTRA_DIST += testdata/data22_3.data
......
......@@ -53,7 +53,7 @@ isc::data::ElementPtr my_config_handler(isc::data::ElementPtr new_config);
The new_config is a ElementPtr pointing to a MapElement containing data in the form as specified by the specification file. It only contains values that were changed.
The module can walk through this set and alter it's behaviour accordingly if necessary. It can also simply check them and return success (see below) and reference the needed configuration values directly when necessary by calling get_config_value(std::string identifier).
The module can walk through this set and alter its behaviour accordingly if necessary. It can also simply check them and return success (see below) and reference the needed configuration values directly when necessary by calling get_config_value(std::string identifier).
The callback function must return an answer message, which is created with isc::config::createAnswer(). For successful handling of the configuration, it should return the result of createAnswer(0) (0 being the result code for success). If there is a problem, the function can return the result of createAnswer(non-zero, "string_with_error_message"). In this case, the new configuration is not stored, and the error is fed back to the configuration manager.
......
CLEANFILES = b10-config.db
BUILT_SOURCES = b10-config.db
# cfgmgr_test (under lib/python) will override b10-config.db, so we make a
# writable copy in the builddir.
b10-config.db: b10-config.db.master
cp $(srcdir)/b10-config.db.master $@
......@@ -109,7 +109,7 @@ public:
/// The destructor does nothing on the given \c buffer on construction;
/// in fact, it is expected that the user will use the resulting buffer
/// for some post rendering purposes (e.g., send the data to the network).
/// It's user's responsibility to do any necessary cleanup for the
/// It's the user's responsibility to do any necessary cleanup for the
/// \c buffer.
~MessageRenderer();
//@}
......
SUBDIRS = tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
if USE_GXX
AM_CPPFLAGS += -Wno-write-strings
endif
AM_CXXFLAGS = $(B10_CXXFLAGS)
#lib_LTLIBRARIES = libdns_python_name.la libdns_python_rrset.la
#libdns_python_name_la_SOURCES = name_python.cc
......
......@@ -157,7 +157,7 @@ RRClass_init(s_RRClass* self, PyObject* args) {
unsigned int i;
PyObject* bytes = NULL;
// The constructor argument can be a string ("IN"), an integer (1),
// or a sequence of numbers between 0 and 255 (wire code)
// or a sequence of numbers between 0 and 65535 (wire code)
// Note that PyArg_ParseType can set PyError, and we need to clear
// that if we try several like here. Otherwise the *next* python
......@@ -170,7 +170,7 @@ RRClass_init(s_RRClass* self, PyObject* args) {
} else if (PyArg_ParseTuple(args, "I", &i)) {
PyErr_Clear();
if (i > 65535) {
PyErr_SetString(po_InvalidRRClass, "Class number too high");
PyErr_SetString(po_InvalidRRClass, "RR class number too high");
return (-1);
}
self->rrclass = new RRClass(i);
......
......@@ -186,8 +186,8 @@ RRType_init(s_RRType* self, PyObject* args) {
const char* s;
unsigned int i;
PyObject* bytes = NULL;
// The constructor argument can be a string ("IN"), an integer (1),
// or a sequence of numbers between 0 and 255 (wire code)
// The constructor argument can be a string ("A"), an integer (1),
// or a sequence of numbers between 0 and 65535 (wire code)
// Note that PyArg_ParseType can set PyError, and we need to clear
// that if we try several like here. Otherwise the *next* python
......@@ -200,7 +200,7 @@ RRType_init(s_RRType* self, PyObject* args) {
} else if (PyArg_ParseTuple(args, "I", &i)) {
PyErr_Clear();
if (i > 65535) {
PyErr_SetString(po_InvalidRRType, "Class number too high");
PyErr_SetString(po_InvalidRRType, "RR Type number too high");
return (-1);
}
self->rrtype = new RRType(i);
......
......@@ -10,6 +10,13 @@ PYTESTS += rrtype_python_test.py
EXTRA_DIST = $(PYTESTS)
# If necessary (rare cases), explicitly specify paths to dynamic libraries
# required by loadable python modules.
LIBRARY_PATH_PLACEHOLDER =
if SET_ENV_LIBRARY_PATH
LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$$$(ENV_LIBRARY_PATH)
endif
# later will have configure option to choose this, like: coverage run --branch
PYCOVERAGE = $(PYTHON)
# test using command-line arguments, so use check-local target instead of TESTS
......@@ -18,5 +25,6 @@ check-local:
echo Running test: $$pytest ; \
env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs \
TESTDATA_PATH=$(abs_top_srcdir)/src/lib/dns/tests/testdata \
$(LIBRARY_PATH_PLACEHOLDER) \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest || exit ; \
done
......@@ -11,5 +11,6 @@ check-local:
echo Running test: $$pytest ; \
env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/lib/config/testdata \
CONFIG_WR_TESTDATA_PATH=$(abs_top_builddir)/src/lib/config/testdata \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest || exit ; \
done
......@@ -28,19 +28,20 @@ from unittest_fakesession import FakeModuleCCSession
class TestConfigManagerData(unittest.TestCase):
def setUp(self):
self.data_path = os.environ['CONFIG_TESTDATA_PATH']
self.config_manager_data = ConfigManagerData(self.data_path)
self.writable_data_path = os.environ['CONFIG_WR_TESTDATA_PATH']
self.config_manager_data = ConfigManagerData(self.writable_data_path)
self.assert_(self.config_manager_data)
def test_init(self):
self.assertEqual(self.config_manager_data.data['version'],
config_data.BIND10_CONFIG_DATA_VERSION)
self.assertEqual(self.config_manager_data.data_path,
self.data_path)
self.writable_data_path)
self.assertEqual(self.config_manager_data.db_filename,
self.data_path + os.sep + "b10-config.db")
self.writable_data_path + os.sep + "b10-config.db")
def test_read_from_file(self):
ConfigManagerData.read_from_file(self.data_path)
ConfigManagerData.read_from_file(self.writable_data_path)
self.assertRaises(ConfigManagerDataEmpty,
ConfigManagerData.read_from_file,
"doesnotexist")
......@@ -84,14 +85,15 @@ class TestConfigManager(unittest.TestCase):
def setUp(self):
self.data_path = os.environ['CONFIG_TESTDATA_PATH']
self.writable_data_path = os.environ['CONFIG_WR_TESTDATA_PATH']
self.fake_session = FakeModuleCCSession()
self.cm = ConfigManager(self.data_path, self.fake_session)
self.cm = ConfigManager(self.writable_data_path, self.fake_session)
self.name = "TestModule"
self.spec = isc.config.module_spec_from_file(self.data_path + os.sep + "/spec2.spec")
def test_init(self):
self.assert_(self.cm.module_specs == {})
self.assert_(self.cm.data_path == self.data_path)
self.assert_(self.cm.data_path == self.writable_data_path)
self.assert_(self.cm.config != None)
self.assert_(self.fake_session.has_subscription("ConfigManager"))
self.assert_(self.fake_session.has_subscription("Boss", "ConfigManager"))
......@@ -293,8 +295,8 @@ class TestConfigManager(unittest.TestCase):
if __name__ == '__main__':
if not 'CONFIG_TESTDATA_PATH' in os.environ:
print("You need to set the environment variable CONFIG_TESTDATA_PATH to point to the directory containing the test data files")
if not 'CONFIG_TESTDATA_PATH' in os.environ or not 'CONFIG_WR_TESTDATA_PATH' in os.environ:
print("You need to set the environment variable CONFIG_TESTDATA_PATH and CONFIG_WR_TESTDATA_PATH to point to the directory containing the test data files")
exit(1)
unittest.main()
# Copyright (C) 2010 Internet Systems Consortium.
#
# Permission to use, copy, modify, and 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 INTERNET SYSTEMS CONSORTIUM
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
# INTERNET SYSTEMS CONSORTIUM 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$
#
# We can probably use a more general version of this
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment