BIND 10 trac1880, updated. d38ed98c96d650931bbe8c49f962807ef85b0245 [1880] Move dontCreateCoreDumps() definition to the header due to dependency issues

BIND 10 source code commits bind10-changes at lists.isc.org
Fri May 4 03:45:50 UTC 2012


The branch, trac1880 has been updated
       via  d38ed98c96d650931bbe8c49f962807ef85b0245 (commit)
      from  863986350d29905c1baf1463b53eaf4adde24e3f (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 d38ed98c96d650931bbe8c49f962807ef85b0245
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri May 4 08:57:16 2012 +0530

    [1880] Move dontCreateCoreDumps() definition to the header due to dependency issues

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

Summary of changes:
 src/lib/log/tests/Makefile.am           |    2 -
 src/lib/server_common/tests/Makefile.am |    1 -
 src/lib/testutils/Makefile.am           |    1 -
 src/lib/testutils/resource.cc           |   36 -------------------------------
 src/lib/testutils/resource.h            |   23 ++++++++++++++++++-
 src/lib/util/tests/Makefile.am          |    1 -
 6 files changed, 21 insertions(+), 43 deletions(-)
 delete mode 100644 src/lib/testutils/resource.cc

-----------------------------------------------------------------------
diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am
index e25c03a..c07eb4a 100644
--- a/src/lib/log/tests/Makefile.am
+++ b/src/lib/log/tests/Makefile.am
@@ -67,7 +67,6 @@ run_unittests_CPPFLAGS = $(AM_CPPFLAGS)
 run_unittests_CXXFLAGS = $(AM_CXXFLAGS)
 run_unittests_LDADD    = $(AM_LDADD)
 run_unittests_LDFLAGS  = $(AM_LDFLAGS)
-run_unittests_LDFLAGS  += $(top_builddir)/src/lib/testutils/libtestutils.la
 
 # logging initialization tests.  These are put in separate programs to
 # ensure that the initialization status at the start of each test is known,
@@ -91,7 +90,6 @@ initializer_unittests_2_CPPFLAGS = $(AM_CPPFLAGS)
 initializer_unittests_2_CXXFLAGS = $(AM_CXXFLAGS)
 initializer_unittests_2_LDADD    = $(AM_LDADD)
 initializer_unittests_2_LDFLAGS  = $(AM_LDFLAGS)
-initializer_unittests_2_LDFLAGS  += $(top_builddir)/src/lib/testutils/libtestutils.la
 
 noinst_PROGRAMS += $(TESTS)
 endif
diff --git a/src/lib/server_common/tests/Makefile.am b/src/lib/server_common/tests/Makefile.am
index 8edcf12..b059d47 100644
--- a/src/lib/server_common/tests/Makefile.am
+++ b/src/lib/server_common/tests/Makefile.am
@@ -48,7 +48,6 @@ run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.
 run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
 run_unittests_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
 run_unittests_LDADD += $(top_builddir)/src/lib/config/tests/libfake_session.la
-run_unittests_LDADD += $(top_builddir)/src/lib/testutils/libtestutils.la
 endif
 
 noinst_PROGRAMS = $(TESTS)
diff --git a/src/lib/testutils/Makefile.am b/src/lib/testutils/Makefile.am
index 62ae012..7a4c8d7 100644
--- a/src/lib/testutils/Makefile.am
+++ b/src/lib/testutils/Makefile.am
@@ -9,7 +9,6 @@ noinst_LTLIBRARIES = libtestutils.la
 
 libtestutils_la_SOURCES = srv_test.h srv_test.cc
 libtestutils_la_SOURCES += dnsmessage_test.h dnsmessage_test.cc
-libtestutils_la_SOURCES += resource.cc resource.h
 libtestutils_la_SOURCES += mockups.h
 libtestutils_la_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 libtestutils_la_LIBADD = $(top_builddir)/src/lib/asiolink/libasiolink.la
diff --git a/src/lib/testutils/resource.cc b/src/lib/testutils/resource.cc
deleted file mode 100644
index eb281d6..0000000
--- a/src/lib/testutils/resource.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2012  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 <sys/time.h>
-#include <sys/resource.h>
-
-#include <gtest/gtest.h>
-
-namespace isc {
-namespace testutils {
-
-void
-dontCreateCoreDumps(void)
-{
-    /* Set rlimits so that no coredumps are created. As a new
-       process is forked to run this EXPECT_DEATH test, the rlimits
-       of the parent process that runs the other tests should be
-       unaffected. */
-    rlimit core_limit = {0, 0};
-
-    EXPECT_EQ(setrlimit(RLIMIT_CORE, &core_limit), 0);
-}
-
-} // end of namespace testutils
-} // end of namespace isc
diff --git a/src/lib/testutils/resource.h b/src/lib/testutils/resource.h
index d901816..41ebf5a 100644
--- a/src/lib/testutils/resource.h
+++ b/src/lib/testutils/resource.h
@@ -15,6 +15,11 @@
 #ifndef __ISC_TESTUTILS_RESOURCE_H
 #define __ISC_TESTUTILS_RESOURCE_H
 
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <gtest/gtest.h>
+
 namespace isc {
 namespace testutils {
 
@@ -25,9 +30,23 @@ namespace testutils {
 /// is used, where processes abort (and create cores in the process).
 /// As a new process is forked to run EXPECT_DEATH tests, the rlimits of
 /// the parent process that runs the other tests should be unaffected.
+///
+/// This function definition is in the header file as otherwise there'd
+/// be a circular dependency from
+/// testutils->asiolink->log->testutils. See bug #1880.
+
+static inline void
+dontCreateCoreDumps(void)
+{
+    /* Set rlimits so that no coredumps are created. As a new
+       process is forked to run this EXPECT_DEATH test, the rlimits
+       of the parent process that runs the other tests should be
+       unaffected. */
+
+    rlimit core_limit = {0, 0};
 
-void
-dontCreateCoreDumps(void);
+    EXPECT_EQ(setrlimit(RLIMIT_CORE, &core_limit), 0);
+}
 
 } // end of namespace testutils
 } // end of namespace isc
diff --git a/src/lib/util/tests/Makefile.am b/src/lib/util/tests/Makefile.am
index 6a5c8a6..dc144bd 100644
--- a/src/lib/util/tests/Makefile.am
+++ b/src/lib/util/tests/Makefile.am
@@ -44,7 +44,6 @@ run_unittests_LDADD += $(top_builddir)/src/lib/util/io/libutil_io.la
 run_unittests_LDADD += \
 	$(top_builddir)/src/lib/util/unittests/libutil_unittests.la
 run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
-run_unittests_LDADD += $(top_builddir)/src/lib/testutils/libtestutils.la
 endif
 
 noinst_PROGRAMS = $(TESTS)



More information about the bind10-changes mailing list