Commit 511e52d9 authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED use the equivalent of /dev/null on windows

On gitlab runner writing in C:\Windows is possible (gitlab runner seems to be run with administrator priviledge!)
parent 139306f3
......@@ -28,8 +28,8 @@ camitk_add_test(EXECUTABLE_ARGS "-error /test"
# should pass because invoking testlogger with an inexistent and impossible to create directory
# results in printing an "Argument error" message (and exit failure)
if(WIN32) # this test fails on windows7 VM due to missing tweek for -debug
set(BAD_DIRECTORY "C:/Windows/test")
if(WIN32)
set(BAD_DIRECTORY "C:/NUL/test") # NUL works a bit like /dev/null see https://docs.microsoft.com/en-us/previous-versions/windows/embedded/aa939249(v=winembedded.5)
else()
set(BAD_DIRECTORY "/dev/null/test") # works on VM, docker and host
endif()
......@@ -43,6 +43,7 @@ else()
set(LOG_OUTPUT_FILE log-default-linux.log)
endif()
# Last test should have the same output as log-default-*.log depending on the OS
camitk_add_test(EXECUTABLE_ARGS "-d ${CMAKE_CURRENT_BINARY_DIR}/testlogger"
PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LOG_OUTPUT_FILE}
PROJECT_NAME ${APPLICATION_TARGET_NAME}
......
......@@ -2,7 +2,6 @@
# add_definitions(-DCAMITK_DISABLE_LOG)
camitk_application()
#----------
# Testing
#----------
......@@ -29,7 +28,7 @@ camitk_add_test(EXECUTABLE_ARGS "-error /test"
# should pass because invoking testlogger with an inexistent and impossible to create directory
# results in printing an "Argument error" message (and exit failure)
if(WIN32) # this test fails on windows7 VM due to missing tweek for -debug
set(BAD_DIRECTORY "C:/Windows/test")
set(BAD_DIRECTORY "C:/NUL/test")
else()
set(BAD_DIRECTORY "/dev/null/test") # fails systematically on VM, docker and host
endif()
......@@ -37,6 +36,7 @@ camitk_add_test(EXECUTABLE_ARGS "-d ${BAD_DIRECTORY}"
PASS_REGULAR_EXPRESSION "Argument errors: "
PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
# Last test should have the same output as log-default.log
camitk_add_test(EXECUTABLE_ARGS "-d ${CMAKE_CURRENT_BINARY_DIR}/testlogger"
PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/log-default.log
PROJECT_NAME ${APPLICATION_TARGET_NAME}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment