You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2020/02/09 20:20:14 UTC
[logging-log4cxx] 34/49: Fix failing defaultinittestcase
This is an automated email from the ASF dual-hosted git repository.
tschoening pushed a commit to branch ghpr_14_replace-ant-build-with-cmake
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit b9d9b0eb3c90f7fc5c4c940e57f0113290cfa155
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Mon Feb 3 17:11:40 2020 +1100
Fix failing defaultinittestcase
---
src/test/cpp/defaultinit/testcase1.cpp | 2 +-
src/test/cpp/defaultinit/testcase2.cpp | 10 ++++++++--
src/test/cpp/defaultinit/testcase3.cpp | 8 +++++++-
src/test/cpp/defaultinit/testcase4.cpp | 8 +++++++-
4 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/test/cpp/defaultinit/testcase1.cpp b/src/test/cpp/defaultinit/testcase1.cpp
index 9d60bb5..b0059a4 100644
--- a/src/test/cpp/defaultinit/testcase1.cpp
+++ b/src/test/cpp/defaultinit/testcase1.cpp
@@ -48,5 +48,5 @@ public:
};
-LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase1)
+LOGUNIT_TEST_SUITE_REGISTRATION(TestCase1)
diff --git a/src/test/cpp/defaultinit/testcase2.cpp b/src/test/cpp/defaultinit/testcase2.cpp
index 13c755d..1c362c2 100644
--- a/src/test/cpp/defaultinit/testcase2.cpp
+++ b/src/test/cpp/defaultinit/testcase2.cpp
@@ -21,6 +21,8 @@
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
+#include <log4cxx/helpers/pool.h>
+#include <apr_file_io.h>
#include "../insertwide.h"
#include "../logunit.h"
@@ -35,17 +37,21 @@ LOGUNIT_CLASS(TestCase2)
public:
void setUp()
{
+ helpers::Pool p;
+ apr_file_copy("input/xml/defaultInit.xml", "log4cxx.xml", APR_FPROT_UREAD|APR_FPROT_UWRITE, p.getAPRPool());
}
void tearDown()
{
+ helpers::Pool p;
+ apr_file_remove("log4cxx.xml", p.getAPRPool());
LogManager::shutdown();
}
void xmlTest()
{
LoggerPtr root = Logger::getRootLogger();
- LOG4CXX_DEBUG(root, "Hello, world");
+ LOG4CXX_DEBUG(root, "Hello, world");
bool rootIsConfigured = !root->getAllAppenders().empty();
LOGUNIT_ASSERT(rootIsConfigured);
@@ -56,6 +62,6 @@ public:
};
-LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase2)
+LOGUNIT_TEST_SUITE_REGISTRATION(TestCase2)
diff --git a/src/test/cpp/defaultinit/testcase3.cpp b/src/test/cpp/defaultinit/testcase3.cpp
index 37e0761..2b36f28 100644
--- a/src/test/cpp/defaultinit/testcase3.cpp
+++ b/src/test/cpp/defaultinit/testcase3.cpp
@@ -17,6 +17,8 @@
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
+#include <log4cxx/helpers/pool.h>
+#include <apr_file_io.h>
#include "../insertwide.h"
#include "../logunit.h"
@@ -31,10 +33,14 @@ LOGUNIT_CLASS(TestCase3)
public:
void setUp()
{
+ helpers::Pool p;
+ apr_file_copy("input/defaultInit3.properties", "log4cxx.properties", APR_FPROT_UREAD|APR_FPROT_UWRITE, p.getAPRPool());
}
void tearDown()
{
+ helpers::Pool p;
+ apr_file_remove("log4cxx.properties", p.getAPRPool());
LogManager::shutdown();
}
@@ -52,4 +58,4 @@ public:
};
-LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase3)
+LOGUNIT_TEST_SUITE_REGISTRATION(TestCase3)
diff --git a/src/test/cpp/defaultinit/testcase4.cpp b/src/test/cpp/defaultinit/testcase4.cpp
index 64bc06e..d22806a 100644
--- a/src/test/cpp/defaultinit/testcase4.cpp
+++ b/src/test/cpp/defaultinit/testcase4.cpp
@@ -21,6 +21,8 @@
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
+#include <log4cxx/helpers/pool.h>
+#include <apr_file_io.h>
#include "../insertwide.h"
#include "../logunit.h"
@@ -35,10 +37,14 @@ LOGUNIT_CLASS(TestCase4)
public:
void setUp()
{
+ helpers::Pool p;
+ apr_file_copy("input/xml/defaultInit.xml", "log4cxx.xml", APR_FPROT_UREAD|APR_FPROT_UWRITE, p.getAPRPool());
}
void tearDown()
{
+ helpers::Pool p;
+ apr_file_remove("log4cxx.xml", p.getAPRPool());
LogManager::shutdown();
}
@@ -57,5 +63,5 @@ public:
};
-LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(TestCase4)
+LOGUNIT_TEST_SUITE_REGISTRATION(TestCase4)