mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[master] Merge branch 'trac2899-2'
This commit is contained in:
@@ -1297,6 +1297,8 @@ AC_CONFIG_FILES([Makefile
|
||||
src/lib/xfr/Makefile
|
||||
src/lib/xfr/tests/Makefile
|
||||
src/lib/log/Makefile
|
||||
src/lib/log/interprocess/Makefile
|
||||
src/lib/log/interprocess/tests/Makefile
|
||||
src/lib/log/compiler/Makefile
|
||||
src/lib/log/tests/Makefile
|
||||
src/lib/resolve/Makefile
|
||||
|
@@ -1,4 +1,4 @@
|
||||
SUBDIRS = . compiler tests
|
||||
SUBDIRS = interprocess . compiler tests
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
|
||||
AM_CPPFLAGS += $(BOOST_INCLUDES)
|
||||
@@ -49,6 +49,6 @@ libb10_log_la_CXXFLAGS += -Wno-error
|
||||
endif
|
||||
libb10_log_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES)
|
||||
libb10_log_la_LIBADD = $(top_builddir)/src/lib/util/libb10-util.la
|
||||
libb10_log_la_LIBADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
libb10_log_la_LIBADD += interprocess/libb10-log_interprocess.la
|
||||
libb10_log_la_LIBADD += $(LOG4CPLUS_LIBS)
|
||||
libb10_log_la_LDFLAGS = -no-undefined -version-info 1:0:0
|
||||
|
21
src/lib/log/interprocess/Makefile.am
Normal file
21
src/lib/log/interprocess/Makefile.am
Normal file
@@ -0,0 +1,21 @@
|
||||
SUBDIRS = . tests
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
|
||||
AM_CPPFLAGS += -DLOCKFILE_DIR=\"${localstatedir}/${PACKAGE_NAME}\"
|
||||
AM_CPPFLAGS += $(BOOST_INCLUDES)
|
||||
|
||||
AM_CXXFLAGS = $(B10_CXXFLAGS)
|
||||
|
||||
CLEANFILES = *.gcno *.gcda
|
||||
|
||||
noinst_LTLIBRARIES = libb10-log_interprocess.la
|
||||
|
||||
libb10_log_interprocess_la_SOURCES = interprocess_sync.h
|
||||
libb10_log_interprocess_la_SOURCES += interprocess_sync_file.h
|
||||
libb10_log_interprocess_la_SOURCES += interprocess_sync_file.cc
|
||||
libb10_log_interprocess_la_SOURCES += interprocess_sync_null.h
|
||||
libb10_log_interprocess_la_SOURCES += interprocess_sync_null.cc
|
||||
|
||||
libb10_log_interprocess_la_LIBADD = $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
|
||||
EXTRA_DIST = README
|
13
src/lib/log/interprocess/README
Normal file
13
src/lib/log/interprocess/README
Normal file
@@ -0,0 +1,13 @@
|
||||
The files in this directory implement a helper sub-library of the
|
||||
inter process locking for the log library. We use our own locks
|
||||
because such locks are only available in relatively recent versions of
|
||||
log4cplus. Also (against our usual practice) we somehow re-invented
|
||||
an in-house version of such a general purose library rather than
|
||||
existing proven tools such as boost::interprocess. While we decided
|
||||
to go with the in-house version for the log library at least until we
|
||||
completely swith to log4cplus's native lock support, no other BIND 10
|
||||
module should use this; they should use existing external
|
||||
tools/libraries.
|
||||
|
||||
This sub-library is therefore "hidden" here. As such, none of these
|
||||
files should be installed.
|
@@ -18,7 +18,8 @@
|
||||
#include <string>
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace log {
|
||||
namespace interprocess {
|
||||
|
||||
class InterprocessSyncLocker; // forward declaration
|
||||
|
||||
@@ -143,7 +144,8 @@ protected:
|
||||
InterprocessSync& sync_; ///< Ref to underlying sync object
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace interprocess
|
||||
} // namespace log
|
||||
} // namespace isc
|
||||
|
||||
#endif // INTERPROCESS_SYNC_H
|
@@ -12,7 +12,7 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include "interprocess_sync_file.h"
|
||||
#include <log/interprocess/interprocess_sync_file.h>
|
||||
|
||||
#include <string>
|
||||
#include <cerrno>
|
||||
@@ -26,7 +26,8 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace log {
|
||||
namespace interprocess {
|
||||
|
||||
InterprocessSyncFile::~InterprocessSyncFile() {
|
||||
if (fd_ != -1) {
|
||||
@@ -128,5 +129,6 @@ InterprocessSyncFile::unlock() {
|
||||
return (false);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace interprocess
|
||||
} // namespace log
|
||||
} // namespace isc
|
@@ -15,11 +15,12 @@
|
||||
#ifndef INTERPROCESS_SYNC_FILE_H
|
||||
#define INTERPROCESS_SYNC_FILE_H
|
||||
|
||||
#include <util/interprocess_sync.h>
|
||||
#include <log/interprocess/interprocess_sync.h>
|
||||
#include <exceptions/exceptions.h>
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace log {
|
||||
namespace interprocess {
|
||||
|
||||
/// \brief InterprocessSyncFileError
|
||||
///
|
||||
@@ -85,7 +86,8 @@ private:
|
||||
int fd_; ///< The descriptor for the open file
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace interprocess
|
||||
} // namespace log
|
||||
} // namespace isc
|
||||
|
||||
#endif // INTERPROCESS_SYNC_FILE_H
|
@@ -12,10 +12,11 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include "interprocess_sync_null.h"
|
||||
#include <log/interprocess/interprocess_sync_null.h>
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace log {
|
||||
namespace interprocess {
|
||||
|
||||
InterprocessSyncNull::~InterprocessSyncNull() {
|
||||
}
|
||||
@@ -38,5 +39,6 @@ InterprocessSyncNull::unlock() {
|
||||
return (true);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace interprocess
|
||||
} // namespace log
|
||||
} // namespace isc
|
@@ -15,10 +15,11 @@
|
||||
#ifndef INTERPROCESS_SYNC_NULL_H
|
||||
#define INTERPROCESS_SYNC_NULL_H
|
||||
|
||||
#include <util/interprocess_sync.h>
|
||||
#include <log/interprocess/interprocess_sync.h>
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace log {
|
||||
namespace interprocess {
|
||||
|
||||
/// \brief Null Interprocess Sync Class
|
||||
///
|
||||
@@ -58,7 +59,8 @@ protected:
|
||||
bool unlock();
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace interprocess
|
||||
} // namespace log
|
||||
} // namespace isc
|
||||
|
||||
#endif // INTERPROCESS_SYNC_NULL_H
|
37
src/lib/log/interprocess/tests/Makefile.am
Normal file
37
src/lib/log/interprocess/tests/Makefile.am
Normal file
@@ -0,0 +1,37 @@
|
||||
SUBDIRS = .
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
|
||||
AM_CPPFLAGS += $(BOOST_INCLUDES)
|
||||
# XXX: we'll pollute the top builddir for creating a temporary test file
|
||||
# used to bind a UNIX domain socket so we can minimize the risk of exceeding
|
||||
# the limit of file name path size.
|
||||
AM_CPPFLAGS += -DTEST_DATA_TOPBUILDDIR=\"$(abs_top_builddir)\"
|
||||
AM_CXXFLAGS = $(B10_CXXFLAGS)
|
||||
|
||||
if USE_STATIC_LINK
|
||||
AM_LDFLAGS = -static
|
||||
endif
|
||||
|
||||
CLEANFILES = *.gcno *.gcda
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
|
||||
|
||||
TESTS =
|
||||
if HAVE_GTEST
|
||||
TESTS += run_unittests
|
||||
run_unittests_SOURCES = run_unittests.cc
|
||||
run_unittests_SOURCES += interprocess_sync_file_unittest.cc
|
||||
run_unittests_SOURCES += interprocess_sync_null_unittest.cc
|
||||
|
||||
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
||||
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
|
||||
|
||||
run_unittests_LDADD = ../libb10-log_interprocess.la
|
||||
run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
|
||||
run_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
|
||||
run_unittests_LDADD += $(GTEST_LDADD)
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = $(TESTS)
|
@@ -12,18 +12,16 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <util/interprocess_sync_file.h>
|
||||
#include <log/interprocess/interprocess_sync_file.h>
|
||||
|
||||
#include <util/unittests/check_valgrind.h>
|
||||
#include <util/tests/interprocess_util.h>
|
||||
#include <util/unittests/interprocess_util.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace std;
|
||||
using isc::util::test::parentReadState;
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
using namespace isc::log::interprocess;
|
||||
using isc::util::unittests::parentReadState;
|
||||
|
||||
namespace {
|
||||
TEST(InterprocessSyncFileTest, TestLock) {
|
||||
@@ -150,6 +148,4 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
|
||||
EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test1_lockfile"));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace util
|
||||
} // namespace isc
|
||||
} // unnamed namespace
|
@@ -12,13 +12,13 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include "util/interprocess_sync_null.h"
|
||||
#include <log/interprocess/interprocess_sync_null.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace isc::log::interprocess;
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace {
|
||||
|
||||
TEST(InterprocessSyncNullTest, TestNull) {
|
||||
InterprocessSyncNull sync("test1");
|
||||
@@ -72,5 +72,4 @@ TEST(InterprocessSyncNullTest, TestNull) {
|
||||
EXPECT_TRUE(locker.unlock());
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace isc
|
||||
}
|
25
src/lib/log/interprocess/tests/run_unittests.cc
Normal file
25
src/lib/log/interprocess/tests/run_unittests.cc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2013 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 <util/unittests/run_all.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(int argc, char* argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
setenv("B10_LOCKFILE_DIR_FROM_BUILD", TEST_DATA_TOPBUILDDIR, 1);
|
||||
return (isc::util::unittests::run_all());
|
||||
}
|
@@ -182,7 +182,7 @@ Logger::fatal(const isc::log::MessageID& ident) {
|
||||
// Replace the interprocess synchronization object
|
||||
|
||||
void
|
||||
Logger::setInterprocessSync(isc::util::InterprocessSync* sync) {
|
||||
Logger::setInterprocessSync(isc::log::interprocess::InterprocessSync* sync) {
|
||||
getLoggerPtr()->setInterprocessSync(sync);
|
||||
}
|
||||
|
||||
|
@@ -25,10 +25,13 @@
|
||||
#include <log/message_types.h>
|
||||
#include <log/log_formatter.h>
|
||||
|
||||
#include <util/interprocess_sync.h>
|
||||
|
||||
namespace isc {
|
||||
namespace log {
|
||||
namespace interprocess {
|
||||
// Forward declaration to hide implementation details from normal
|
||||
// applications.
|
||||
class InterprocessSync;
|
||||
}
|
||||
|
||||
/// \page LoggingApi Logging API
|
||||
/// \section LoggingApiOverview Overview
|
||||
@@ -254,11 +257,16 @@ public:
|
||||
/// If this method is called with NULL as the argument, it throws a
|
||||
/// BadInterprocessSync exception.
|
||||
///
|
||||
/// \note This method is intended to be used only within this log library
|
||||
/// and its tests. Normal application shouldn't use it (in fact,
|
||||
/// normal application shouldn't even be able to instantiate
|
||||
/// InterprocessSync objects).
|
||||
///
|
||||
/// \param sync The logger uses this synchronization object for
|
||||
/// synchronizing output of log messages. It should be deletable and
|
||||
/// the ownership is transferred to the logger. If NULL is passed,
|
||||
/// a BadInterprocessSync exception is thrown.
|
||||
void setInterprocessSync(isc::util::InterprocessSync* sync);
|
||||
void setInterprocessSync(isc::log::interprocess::InterprocessSync* sync);
|
||||
|
||||
/// \brief Equality
|
||||
///
|
||||
|
@@ -32,16 +32,15 @@
|
||||
#include <log/logger_manager.h>
|
||||
#include <log/message_dictionary.h>
|
||||
#include <log/message_types.h>
|
||||
#include <log/interprocess/interprocess_sync_file.h>
|
||||
|
||||
#include <util/strutil.h>
|
||||
#include <util/interprocess_sync_file.h>
|
||||
|
||||
// Note: as log4cplus and the BIND 10 logger have many concepts in common, and
|
||||
// thus many similar names, to disambiguate types we don't "use" the log4cplus
|
||||
// namespace: instead, all log4cplus types are explicitly qualified.
|
||||
|
||||
using namespace std;
|
||||
using namespace isc::util;
|
||||
|
||||
namespace isc {
|
||||
namespace log {
|
||||
@@ -54,7 +53,7 @@ namespace log {
|
||||
LoggerImpl::LoggerImpl(const string& name) :
|
||||
name_(expandLoggerName(name)),
|
||||
logger_(log4cplus::Logger::getInstance(name_)),
|
||||
sync_(new InterprocessSyncFile("logger"))
|
||||
sync_(new interprocess::InterprocessSyncFile("logger"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -112,7 +111,8 @@ LoggerImpl::lookupMessage(const MessageID& ident) {
|
||||
// Replace the interprocess synchronization object
|
||||
|
||||
void
|
||||
LoggerImpl::setInterprocessSync(isc::util::InterprocessSync* sync) {
|
||||
LoggerImpl::setInterprocessSync(isc::log::interprocess::InterprocessSync* sync)
|
||||
{
|
||||
if (sync == NULL) {
|
||||
isc_throw(BadInterprocessSync,
|
||||
"NULL was passed to setInterprocessSync()");
|
||||
@@ -130,7 +130,7 @@ LoggerImpl::outputRaw(const Severity& severity, const string& message) {
|
||||
|
||||
// Use an interprocess sync locker for mutual exclusion from other
|
||||
// processes to avoid log messages getting interspersed.
|
||||
InterprocessSyncLocker locker(*sync_);
|
||||
interprocess::InterprocessSyncLocker locker(*sync_);
|
||||
|
||||
if (!locker.lock()) {
|
||||
LOG4CPLUS_ERROR(logger_, "Unable to lock logger lockfile");
|
||||
|
@@ -31,8 +31,7 @@
|
||||
// BIND-10 logger files
|
||||
#include <log/logger_level_impl.h>
|
||||
#include <log/message_types.h>
|
||||
|
||||
#include <util/interprocess_sync.h>
|
||||
#include <log/interprocess/interprocess_sync.h>
|
||||
|
||||
namespace isc {
|
||||
namespace log {
|
||||
@@ -178,7 +177,7 @@ public:
|
||||
/// synchronizing output of log messages. It should be deletable and
|
||||
/// the ownership is transferred to the logger implementation.
|
||||
/// If NULL is passed, a BadInterprocessSync exception is thrown.
|
||||
void setInterprocessSync(isc::util::InterprocessSync* sync);
|
||||
void setInterprocessSync(isc::log::interprocess::InterprocessSync* sync);
|
||||
|
||||
/// \brief Equality
|
||||
///
|
||||
@@ -193,7 +192,7 @@ public:
|
||||
private:
|
||||
std::string name_; ///< Full name of this logger
|
||||
log4cplus::Logger logger_; ///< Underlying log4cplus logger
|
||||
isc::util::InterprocessSync* sync_;
|
||||
isc::log::interprocess::InterprocessSync* sync_;
|
||||
};
|
||||
|
||||
} // namespace log
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include <log/message_initializer.h>
|
||||
#include <log/message_reader.h>
|
||||
#include <log/message_types.h>
|
||||
#include "util/interprocess_sync_null.h"
|
||||
#include <log/interprocess/interprocess_sync_null.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -157,7 +157,8 @@ LoggerManager::readLocalMessageFile(const char* file) {
|
||||
// be used by standalone programs which may not have write access to
|
||||
// the local state directory (to create lock files). So we switch to
|
||||
// using a null interprocess sync object here.
|
||||
logger.setInterprocessSync(new isc::util::InterprocessSyncNull("logger"));
|
||||
logger.setInterprocessSync(
|
||||
new isc::log::interprocess::InterprocessSyncNull("logger"));
|
||||
|
||||
try {
|
||||
|
||||
|
@@ -25,7 +25,6 @@ logger_example_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
logger_example_LDFLAGS = $(AM_LDFLAGS)
|
||||
logger_example_LDADD = $(top_builddir)/src/lib/log/libb10-log.la
|
||||
logger_example_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
|
||||
logger_example_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
logger_example_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
|
||||
logger_example_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
|
||||
|
||||
@@ -35,7 +34,6 @@ init_logger_test_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
init_logger_test_LDFLAGS = $(AM_LDFLAGS)
|
||||
init_logger_test_LDADD = $(top_builddir)/src/lib/log/libb10-log.la
|
||||
init_logger_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
|
||||
init_logger_test_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
init_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
|
||||
init_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
|
||||
|
||||
@@ -45,10 +43,11 @@ buffer_logger_test_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
buffer_logger_test_LDFLAGS = $(AM_LDFLAGS)
|
||||
buffer_logger_test_LDADD = $(top_builddir)/src/lib/log/libb10-log.la
|
||||
buffer_logger_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
|
||||
buffer_logger_test_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
buffer_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
|
||||
buffer_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
|
||||
|
||||
# This test directly uses libb10-threads, and on some systems it seems to
|
||||
# require explicit LDADD (even if libb10-log has indirect dependencies)
|
||||
noinst_PROGRAMS += logger_lock_test
|
||||
logger_lock_test_SOURCES = logger_lock_test.cc
|
||||
nodist_logger_lock_test_SOURCES = log_test_messages.cc log_test_messages.h
|
||||
@@ -75,7 +74,6 @@ AM_CPPFLAGS += $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
|
||||
AM_LDFLAGS += $(GTEST_LDFLAGS)
|
||||
|
||||
AM_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
|
||||
AM_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la
|
||||
AM_LDADD += $(top_builddir)/src/lib/log/libb10-log.la
|
||||
AM_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
|
||||
AM_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include <log/logger_support.h>
|
||||
#include <log/logger_manager.h>
|
||||
#include <log/log_messages.h>
|
||||
#include <util/interprocess_sync_null.h>
|
||||
#include <log/interprocess/interprocess_sync_null.h>
|
||||
|
||||
using namespace isc::log;
|
||||
|
||||
@@ -58,7 +58,8 @@ main(int argc, char** argv) {
|
||||
initLogger("buffertest", isc::log::INFO, 0, NULL, true);
|
||||
Logger logger("log");
|
||||
// No need for file interprocess locking in this test
|
||||
logger.setInterprocessSync(new isc::util::InterprocessSyncNull("logger"));
|
||||
logger.setInterprocessSync(
|
||||
new isc::log::interprocess::InterprocessSyncNull("logger"));
|
||||
LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info");
|
||||
LOG_DEBUG(logger, 50, LOG_BAD_DESTINATION).arg("debug-50");
|
||||
LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info");
|
||||
|
@@ -41,11 +41,11 @@
|
||||
|
||||
// Include a set of message definitions.
|
||||
#include <log/log_messages.h>
|
||||
#include "util/interprocess_sync_null.h"
|
||||
#include <log/interprocess/interprocess_sync_null.h>
|
||||
|
||||
using namespace isc::log;
|
||||
using namespace std;
|
||||
|
||||
using isc::log::interprocess::InterprocessSyncNull;
|
||||
|
||||
// Print usage information
|
||||
|
||||
@@ -286,11 +286,11 @@ int main(int argc, char** argv) {
|
||||
// have write access to a local state directory to create
|
||||
// lockfiles).
|
||||
isc::log::Logger logger_ex(ROOT_NAME);
|
||||
logger_ex.setInterprocessSync(new isc::util::InterprocessSyncNull("logger"));
|
||||
logger_ex.setInterprocessSync(new InterprocessSyncNull("logger"));
|
||||
isc::log::Logger logger_alpha("alpha");
|
||||
logger_alpha.setInterprocessSync(new isc::util::InterprocessSyncNull("logger"));
|
||||
logger_alpha.setInterprocessSync(new InterprocessSyncNull("logger"));
|
||||
isc::log::Logger logger_beta("beta");
|
||||
logger_beta.setInterprocessSync(new isc::util::InterprocessSyncNull("logger"));
|
||||
logger_beta.setInterprocessSync(new InterprocessSyncNull("logger"));
|
||||
|
||||
LOG_FATAL(logger_ex, LOG_WRITE_ERROR).arg("test1").arg("42");
|
||||
LOG_ERROR(logger_ex, LOG_READING_LOCAL_FILE).arg("dummy/file");
|
||||
|
@@ -16,15 +16,17 @@
|
||||
#include <log/logger_support.h>
|
||||
#include <log/logger_manager.h>
|
||||
#include <log/log_messages.h>
|
||||
#include "util/interprocess_sync.h"
|
||||
#include <log/interprocess/interprocess_sync.h>
|
||||
#include "log_test_messages.h"
|
||||
|
||||
#include <util/threads/sync.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace isc::log;
|
||||
using isc::util::thread::Mutex;
|
||||
|
||||
class MockLoggingSync : public isc::util::InterprocessSync {
|
||||
class MockLoggingSync : public isc::log::interprocess::InterprocessSync {
|
||||
public:
|
||||
/// \brief Constructor
|
||||
MockLoggingSync(const std::string& component_name) :
|
||||
|
@@ -20,10 +20,9 @@
|
||||
#include <log/logger_manager.h>
|
||||
#include <log/logger_name.h>
|
||||
#include <log/log_messages.h>
|
||||
#include <log/interprocess/interprocess_sync_file.h>
|
||||
#include "log/tests/log_test_messages.h"
|
||||
|
||||
#include <util/interprocess_sync_file.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
@@ -391,7 +390,7 @@ TEST_F(LoggerTest, setInterprocessSync) {
|
||||
EXPECT_THROW(logger.setInterprocessSync(NULL), BadInterprocessSync);
|
||||
}
|
||||
|
||||
class MockSync : public isc::util::InterprocessSync {
|
||||
class MockSync : public isc::log::interprocess::InterprocessSync {
|
||||
public:
|
||||
/// \brief Constructor
|
||||
MockSync(const std::string& component_name) :
|
||||
|
@@ -4,7 +4,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/util -I$(top_builddir)/src/lib/util
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/exceptions -I$(top_builddir)/src/lib/exceptions
|
||||
AM_CPPFLAGS += $(BOOST_INCLUDES)
|
||||
AM_CPPFLAGS += -DLOCKFILE_DIR=\"${localstatedir}/${PACKAGE_NAME}\"
|
||||
AM_CXXFLAGS = $(B10_CXXFLAGS)
|
||||
# If we use the shared-memory support, corresponding Boost library may
|
||||
# cause build failures especially if it's strict about warnings. We've
|
||||
@@ -25,9 +24,6 @@ libb10_util_la_SOURCES += locks.h lru_list.h
|
||||
libb10_util_la_SOURCES += strutil.h strutil.cc
|
||||
libb10_util_la_SOURCES += buffer.h io_utilities.h
|
||||
libb10_util_la_SOURCES += time_utilities.h time_utilities.cc
|
||||
libb10_util_la_SOURCES += interprocess_sync.h
|
||||
libb10_util_la_SOURCES += interprocess_sync_file.h interprocess_sync_file.cc
|
||||
libb10_util_la_SOURCES += interprocess_sync_null.h interprocess_sync_null.cc
|
||||
libb10_util_la_SOURCES += memory_segment.h
|
||||
libb10_util_la_SOURCES += memory_segment_local.h memory_segment_local.cc
|
||||
if USE_SHARED_MEMORY
|
||||
|
@@ -31,8 +31,6 @@ run_unittests_SOURCES += filename_unittest.cc
|
||||
run_unittests_SOURCES += hex_unittest.cc
|
||||
run_unittests_SOURCES += io_utilities_unittest.cc
|
||||
run_unittests_SOURCES += lru_list_unittest.cc
|
||||
run_unittests_SOURCES += interprocess_sync_file_unittest.cc
|
||||
run_unittests_SOURCES += interprocess_sync_null_unittest.cc
|
||||
run_unittests_SOURCES += memory_segment_local_unittest.cc
|
||||
if USE_SHARED_MEMORY
|
||||
run_unittests_SOURCES += memory_segment_mapped_unittest.cc
|
||||
@@ -46,7 +44,6 @@ run_unittests_SOURCES += socketsession_unittest.cc
|
||||
run_unittests_SOURCES += strutil_unittest.cc
|
||||
run_unittests_SOURCES += time_utilities_unittest.cc
|
||||
run_unittests_SOURCES += range_utilities_unittest.cc
|
||||
run_unittests_SOURCES += interprocess_util.h interprocess_util.cc
|
||||
|
||||
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
||||
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <util/tests/memory_segment_common_unittest.h>
|
||||
#include <util/unittests/check_valgrind.h>
|
||||
#include <util/tests/interprocess_util.h>
|
||||
#include <util/unittests/interprocess_util.h>
|
||||
|
||||
#include <util/memory_segment_mapped.h>
|
||||
#include <exceptions/exceptions.h>
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
using namespace isc::util;
|
||||
using boost::scoped_ptr;
|
||||
using isc::util::test::parentReadState;
|
||||
using isc::util::unittests::parentReadState;
|
||||
|
||||
namespace {
|
||||
// Shortcut to keep code shorter
|
||||
|
@@ -20,6 +20,5 @@ int
|
||||
main(int argc, char* argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
setenv("B10_LOCKFILE_DIR_FROM_BUILD", TEST_DATA_TOPBUILDDIR, 1);
|
||||
return (isc::util::unittests::run_all());
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ libutil_unittests_la_SOURCES += check_valgrind.h check_valgrind.cc
|
||||
libutil_unittests_la_SOURCES += run_all.h run_all.cc
|
||||
libutil_unittests_la_SOURCES += textdata.h
|
||||
libutil_unittests_la_SOURCES += wiredata.h wiredata.cc
|
||||
libutil_unittests_la_SOURCES += interprocess_util.h interprocess_util.cc
|
||||
endif
|
||||
|
||||
# For now, this isn't needed for libutil_unittests
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace test {
|
||||
namespace unittests {
|
||||
|
||||
unsigned char
|
||||
parentReadState(int fd) {
|
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace isc {
|
||||
namespace util {
|
||||
namespace test {
|
||||
namespace unittests {
|
||||
/// \brief A helper utility for a simple synchronization with another process.
|
||||
///
|
||||
/// It waits for incoming data on a given file descriptor up to 5 seconds
|
Reference in New Issue
Block a user