BIND 10 trac2198_4, updated. 7cb5ebd30bb1e7896a88a02b0748ee4a801152e5 [2198] Check that the logger locks the LoggerManager mutex before calling log4cplus

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 30 03:56:46 UTC 2012


The branch, trac2198_4 has been updated
       via  7cb5ebd30bb1e7896a88a02b0748ee4a801152e5 (commit)
      from  a7e6d2d9fa185995a78a9618e933a039e3614a64 (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 7cb5ebd30bb1e7896a88a02b0748ee4a801152e5
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Oct 30 09:16:52 2012 +0530

    [2198] Check that the logger locks the LoggerManager mutex before calling log4cplus

-----------------------------------------------------------------------

Summary of changes:
 src/lib/log/tests/Makefile.am            |    7 +++++++
 src/lib/log/tests/logger_lock_test.cc    |   11 +++++++++++
 src/lib/log/tests/logger_lock_test.sh.in |    1 +
 3 files changed, 19 insertions(+)

-----------------------------------------------------------------------
diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am
index 3ac19a4..4df41e8 100644
--- a/src/lib/log/tests/Makefile.am
+++ b/src/lib/log/tests/Makefile.am
@@ -120,6 +120,13 @@ endif
 # output needs to be compared with stored output (where "cut" and
 # "diff" are useful utilities).
 
+noinst_SCRIPTS  = console_test.sh
+noinst_SCRIPTS += destination_test.sh
+noinst_SCRIPTS += init_logger_test.sh
+noinst_SCRIPTS += local_file_test.sh
+noinst_SCRIPTS += logger_lock_test.sh
+noinst_SCRIPTS += severity_test.sh
+
 check-local:
 	$(SHELL) $(abs_builddir)/console_test.sh
 	$(SHELL) $(abs_builddir)/destination_test.sh
diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc
index d63989c..7fed5c7 100644
--- a/src/lib/log/tests/logger_lock_test.cc
+++ b/src/lib/log/tests/logger_lock_test.cc
@@ -14,6 +14,7 @@
 
 #include <log/macros.h>
 #include <log/logger_support.h>
+#include <log/logger_manager.h>
 #include <log/log_messages.h>
 #include "util/interprocess_sync.h"
 #include "log_test_messages.h"
@@ -21,6 +22,7 @@
 
 using namespace std;
 using namespace isc::log;
+using isc::util::thread::Mutex;
 
 class MockLoggingSync : public isc::util::InterprocessSync {
 public:
@@ -31,6 +33,15 @@ public:
 
 protected:
     virtual bool lock() {
+        // We first check if the logger acquired a lock on the
+        // LoggerManager mutex.
+        try {
+            // This lock attempt is non-blocking.
+            Mutex::Locker locker(LoggerManager::getMutex(), false);
+        } catch (Mutex::Locker::AlreadyLocked& e) {
+            cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: MUTEXLOCK\n";
+        }
+
         cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: LOCK\n";
         return (true);
     }
diff --git a/src/lib/log/tests/logger_lock_test.sh.in b/src/lib/log/tests/logger_lock_test.sh.in
index 0324499..0194cf8 100755
--- a/src/lib/log/tests/logger_lock_test.sh.in
+++ b/src/lib/log/tests/logger_lock_test.sh.in
@@ -31,6 +31,7 @@ passfail() {
 
 echo -n  "Testing that logger acquires and releases locks correctly:"
 cat > $tempfile << .
+LOGGER_LOCK_TEST: MUTEXLOCK
 LOGGER_LOCK_TEST: LOCK
 INFO  [bind10.log] LOG_LOCK_TEST_MESSAGE this is a test message.
 LOGGER_LOCK_TEST: UNLOCK



More information about the bind10-changes mailing list