Prevent test case failures on Windows by excluding tests that require 'sed'
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 @@
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 @@
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)