BIND 10 master, updated. a5e9d9176e9c60ef20c0f5ef59eeb6838ed47ab2 [master] Merge branch 'trac1387'
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Dec 8 21:08:37 UTC 2011
The branch, master has been updated
via a5e9d9176e9c60ef20c0f5ef59eeb6838ed47ab2 (commit)
via 0c8c0f808a9ddc3a27a87f55964a965fb30f18ef (commit)
via df44752c7d69b865fa346215c1ec428153d5a3ca (commit)
via 0ae049de728692224b087e95a645f45f4a69cb68 (commit)
from e82cf73f21e06b1a301ff120fb5f73203d343111 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a5e9d9176e9c60ef20c0f5ef59eeb6838ed47ab2
Merge: e82cf73 0c8c0f8
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Thu Dec 8 12:54:25 2011 -0800
[master] Merge branch 'trac1387'
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 1 +
src/lib/xfr/Makefile.am | 2 +
src/lib/{cryptolink => xfr}/tests/Makefile.am | 14 ++++------
.../tempdir.h.in => xfr/tests/client_test.cc} | 26 +++++++++++++-------
src/lib/{acl => xfr}/tests/run_unittests.cc | 0
src/lib/xfr/xfrout_client.cc | 9 ++++---
6 files changed, 31 insertions(+), 21 deletions(-)
copy src/lib/{cryptolink => xfr}/tests/Makefile.am (54%)
copy src/lib/{log/tests/tempdir.h.in => xfr/tests/client_test.cc} (61%)
copy src/lib/{acl => xfr}/tests/run_unittests.cc (100%)
-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 917a32d..973842f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -912,6 +912,7 @@ AC_CONFIG_FILES([Makefile
src/lib/datasrc/tests/Makefile
src/lib/datasrc/tests/testdata/Makefile
src/lib/xfr/Makefile
+ src/lib/xfr/tests/Makefile
src/lib/log/Makefile
src/lib/log/compiler/Makefile
src/lib/log/tests/Makefile
diff --git a/src/lib/xfr/Makefile.am b/src/lib/xfr/Makefile.am
index d714990..3d7f60f 100644
--- a/src/lib/xfr/Makefile.am
+++ b/src/lib/xfr/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = . tests
+
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
AM_CPPFLAGS += $(BOOST_INCLUDES)
diff --git a/src/lib/xfr/tests/Makefile.am b/src/lib/xfr/tests/Makefile.am
new file mode 100644
index 0000000..4abb456
--- /dev/null
+++ b/src/lib/xfr/tests/Makefile.am
@@ -0,0 +1,25 @@
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CXXFLAGS = $(B10_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
+
+CLEANFILES = *.gcno *.gcda
+
+TESTS =
+if HAVE_GTEST
+TESTS += run_unittests
+run_unittests_SOURCES = run_unittests.cc client_test.cc
+
+run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
+
+run_unittests_LDADD = $(GTEST_LDADD)
+run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
+run_unittests_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
+run_unittests_LDADD += $(top_builddir)/src/lib/log/liblog.la
+endif
+
+noinst_PROGRAMS = $(TESTS)
diff --git a/src/lib/xfr/tests/client_test.cc b/src/lib/xfr/tests/client_test.cc
new file mode 100644
index 0000000..6c9f4ad
--- /dev/null
+++ b/src/lib/xfr/tests/client_test.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 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.
+
+#include <gtest/gtest.h>
+
+#include <sys/un.h>
+#include <string>
+
+#include <xfr/xfrout_client.h>
+
+using namespace std;
+using namespace isc::xfr;
+
+namespace {
+
+TEST(ClientTest, connetFile) {
+ // File path is too long
+ struct sockaddr_un s; // can't be const; some compiler complains
+ EXPECT_THROW(XfroutClient(string(sizeof(s.sun_path), 'x')).connect(),
+ XfroutError);
+
+ // File doesn't exist (we assume the file "no_such_file" doesn't exist)
+ EXPECT_THROW(XfroutClient("no_such_file").connect(), XfroutError);
+}
+
+}
diff --git a/src/lib/xfr/tests/run_unittests.cc b/src/lib/xfr/tests/run_unittests.cc
new file mode 100644
index 0000000..8dc59a2
--- /dev/null
+++ b/src/lib/xfr/tests/run_unittests.cc
@@ -0,0 +1,24 @@
+// Copyright (C) 2011 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.
+
+#include <gtest/gtest.h>
+#include <log/logger_support.h>
+#include <util/unittests/run_all.h>
+
+int
+main(int argc, char* argv[]) {
+ ::testing::InitGoogleTest(&argc, argv);
+ isc::log::initLogger();
+ return (isc::util::unittests::run_all());
+}
diff --git a/src/lib/xfr/xfrout_client.cc b/src/lib/xfr/xfrout_client.cc
index 6ab905b..227ffc4 100644
--- a/src/lib/xfr/xfrout_client.cc
+++ b/src/lib/xfr/xfrout_client.cc
@@ -52,10 +52,11 @@ XfroutClient::~XfroutClient() {
void
XfroutClient::connect() {
- asio::error_code err;
- impl_->socket_.connect(stream_protocol::endpoint(impl_->file_path_), err);
- if (err) {
- isc_throw(XfroutError, "socket connect failed: " << err.message());
+ try {
+ impl_->socket_.connect(stream_protocol::endpoint(impl_->file_path_));
+ } catch (const asio::system_error& err) {
+ isc_throw(XfroutError, "socket connect failed for " <<
+ impl_->file_path_ << ": " << err.what());
}
}
More information about the bind10-changes
mailing list