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/10 09:04:11 UTC

[logging-log4cxx] 04/07: Prevent test case failures on Windows by excluding tests that require 'sed'

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 af0134afaf2cd8d85d60aca3bae4b627d57b8c48
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Mon Feb 10 18:07:19 2020 +1100

    Prevent test case failures on Windows by excluding tests that require 'sed'
---
 src/test/cpp/CMakeLists.txt       | 9 +++++++--
 src/test/cpp/net/CMakeLists.txt   | 4 ++--
 src/test/cpp/varia/CMakeLists.txt | 5 ++++-
 src/test/cpp/xml/CMakeLists.txt   | 6 ++++--
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
index 91e7a93..6f86351 100644
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Determine whether to include tests that call sed
+find_program(sedProgram sed)
+
 # Components required by all tests
 add_library(testingFramework STATIC abts.cpp appenderskeletontestcase.cpp logunit.cpp vectorappender.cpp writerappendertestcase.cpp )
 target_include_directories(testingFramework PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
@@ -19,13 +22,15 @@ set(ALL_LOG4CXX_TESTS
     leveltestcase
     loggertestcase
     mdctestcase
-    minimumtestcase
     ndctestcase
-    patternlayouttest
+   
     propertyconfiguratortest
     rollingfileappendertestcase
     streamtestcase
 )
+if(sedProgram)
+    list(APPEND ALL_LOG4CXX_TESTS minimumtestcase patternlayouttest)
+endif()
 foreach(fileName IN LISTS ALL_LOG4CXX_TESTS)
     add_executable(${fileName} "${fileName}.cpp")
 endforeach()
diff --git a/src/test/cpp/net/CMakeLists.txt b/src/test/cpp/net/CMakeLists.txt
index a11e603..bee6f34 100644
--- a/src/test/cpp/net/CMakeLists.txt
+++ b/src/test/cpp/net/CMakeLists.txt
@@ -13,9 +13,9 @@ endif(HAS_LIBESMPT)
 foreach(fileName IN LISTS NET_TESTS)
     add_executable(${fileName} "${fileName}.cpp")
 endforeach()
-if(Java_Development_FOUND)
+if(Java_Development_FOUND AND sedProgram)
     add_executable(socketservertestcase socketserverstarter.cpp socketservertestcase.cpp)
     add_dependencies(socketservertestcase test-classes)
     list(APPEND NET_TESTS socketservertestcase)
-endif(Java_Development_FOUND)
+endif()
 set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} ${NET_TESTS} PARENT_SCOPE)
diff --git a/src/test/cpp/varia/CMakeLists.txt b/src/test/cpp/varia/CMakeLists.txt
index aeaeeb4..2bef8aa 100644
--- a/src/test/cpp/varia/CMakeLists.txt
+++ b/src/test/cpp/varia/CMakeLists.txt
@@ -1,9 +1,12 @@
 # Tests defined in this directory
 set(VARIA_TESTS
-    errorhandlertestcase
     levelmatchfiltertestcase
     levelrangefiltertestcase
 )
+if(sedProgram)
+    list(APPEND VARIA_TESTS errorhandlertestcase)
+endif()
+
 foreach(fileName  IN LISTS VARIA_TESTS)
     add_executable(${fileName} "${fileName}.cpp")
 endforeach()
diff --git a/src/test/cpp/xml/CMakeLists.txt b/src/test/cpp/xml/CMakeLists.txt
index cd8bcf5..e9e421b 100644
--- a/src/test/cpp/xml/CMakeLists.txt
+++ b/src/test/cpp/xml/CMakeLists.txt
@@ -1,7 +1,9 @@
 add_executable(xmltests
-    domtestcase
     xmllayouttest
-    xmllayouttestcase
 )
+if(sedProgram)
+    list(APPEND xmltests domtestcase xmllayouttestcase)
+endif()
+
 target_link_libraries(xmltests PRIVATE ${APR_UTIL_LIBRARIES})
 set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} xmltests PARENT_SCOPE)