#include "config.h"
#include <gtest/gtest.h>
-#ifdef EXPECT_DEATH
-#include <testutils/resource.h>
-#endif /* EXPECT_DEATH */
+#include <util/unittests/resource.h>
#include <log/log_formatter.h>
#include <log/logger_level.h>
// don't match number of arguments. This causes it to abort.
TEST_F(FormatterTest, mismatchedPlaceholders) {
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
Formatter(isc::log::INFO, s("Missing the first %2"), this).arg("missing").arg("argument");
}, ".*");
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
Formatter(isc::log::INFO, s("Too many arguments in %1 %2"), this).arg("only one");
}, ".*");
}
#include <gtest/gtest.h>
-#ifdef EXPECT_DEATH
-#include <testutils/resource.h>
-#endif /* EXPECT_DEATH */
+#include <util/unittests/resource.h>
#include <log/logger.h>
#include <log/logger_manager.h>
// Note that we just check that it dies - we don't check what message is
// output.
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
string ok3(Logger::MAX_LOGGER_NAME_SIZE + 1, 'x');
Logger l3(ok3.c_str());
#include <log/message_initializer.h>
#include <gtest/gtest.h>
-#ifdef EXPECT_DEATH
-#include <testutils/resource.h>
-#endif /* EXPECT_DEATH */
+#include <util/unittests/resource.h>
using namespace isc::log;
#ifdef EXPECT_DEATH
// Adding one more should take us over the limit.
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
MessageInitializer initializer2(values);
}, ".*");
#include <testutils/socket_request.h>
#include <testutils/mockups.h>
-#ifdef EXPECT_DEATH
-#include <testutils/resource.h>
-#endif /* EXPECT_DEATH */
+#include <util/unittests/resource.h>
#include <cc/data.h>
#include <exceptions/exceptions.h>
// Make sure it actually kills the application (there should be an abort
// in this case)
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
try {
installListenAddresses(deathAddresses, store_, dnss_);
// Instruct it to fail on close
sock_requestor_.break_release_ = true;
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
try {
// Setting to empty will close all current sockets.
libtestutils_la_LIBADD = $(top_builddir)/src/lib/asiolink/libasiolink.la
endif
-EXTRA_DIST = portconfig.h resource.h socket_request.h
+EXTRA_DIST = portconfig.h socket_request.h
#include <exceptions/exceptions.h>
#ifdef EXPECT_DEATH
-#include <testutils/resource.h>
+#include <util/unittests/resource.h>
#endif /* EXPECT_DEATH */
#include <util/buffer.h>
#ifdef EXPECT_DEATH
// We use assert now, so we check it dies
EXPECT_DEATH({
- isc::testutils::dontCreateCoreDumps();
+ isc::util::unittests::dontCreateCoreDumps();
try {
obuffer[sizeof(testdata)];
libutil_unittests_la_SOURCES += newhook.h newhook.cc
libutil_unittests_la_SOURCES += testdata.h testdata.cc
if HAVE_GTEST
+libutil_unittests_la_SOURCES += resource.h resource.cc
libutil_unittests_la_SOURCES += run_all.h run_all.cc
libutil_unittests_la_SOURCES += textdata.h
endif
--- /dev/null
+// 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 "resource.h"
+
+#include <gtest/gtest.h>
+
+#include <sys/time.h>
+#include <sys/resource.h>
+
+namespace isc {
+namespace util {
+namespace unittests {
+
+void
+dontCreateCoreDumps() {
+ const rlimit core_limit = {0, 0};
+
+ EXPECT_EQ(setrlimit(RLIMIT_CORE, &core_limit), 0);
+}
+
+} // end of namespace unittests
+} // end of namespace util
+} // end of namespace isc
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#ifndef __ISC_TESTUTILS_RESOURCE_H
-#define __ISC_TESTUTILS_RESOURCE_H
-
-#include <sys/time.h>
-#include <sys/resource.h>
-
-#include <gtest/gtest.h>
+#ifndef __UTIL_UNITTESTS_RESOURCE_H
+#define __UTIL_UNITTESTS_RESOURCE_H 1
namespace isc {
-namespace testutils {
+namespace util {
+namespace unittests {
/// Don't create core dumps.
///
/// 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.
-
-namespace {
-
-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. */
+void dontCreateCoreDumps();
- rlimit core_limit = {0, 0};
-
- EXPECT_EQ(setrlimit(RLIMIT_CORE, &core_limit), 0);
-}
-
-} // end of anonymous namespace
-
-} // end of namespace testutils
+} // end of namespace unittests
+} // end of namespace util
} // end of namespace isc
-#endif /* __ISC_TESTUTILS_RESOURCE_H */
+#endif /* __UTIL_UNITTESTS_RESOURCE_H */
+
+// Local Variables:
+// mode: c++
+// End: