mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Guard against EVENT_NOWIN32 being set during testing.
On windows all tests will fail if EVENT_NOWIN32 is set, since then there will be no backend available. Question is if we should simply disable the environment variable check on Windows, since there's only one backend available anyway?
This commit is contained in:
parent
d7be788780
commit
f1715b471d
@ -925,8 +925,25 @@ if (NOT EVENT__DISABLE_TESTS)
|
||||
# (Important! This will unset all EVENT_NO* environment variables.
|
||||
# If they are set in the shell the tests are running using simply "ctest" or "make test" will fail)
|
||||
if (WIN32)
|
||||
# Windows doesn't have "unset", and the above does not happen anyway.
|
||||
add_custom_target(verify COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
# Windows doesn't have "unset". But you can use "set VAR=" instead.
|
||||
# We need to guard against the possibility taht EVENT_NOWIN32 is set, and all test failing
|
||||
# since no event backend being available.
|
||||
file(TO_NATIVE_PATH ${CMAKE_CTEST_COMMAND} WINDOWS_CTEST_COMMAND)
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/verify_tests.bat
|
||||
"
|
||||
set EVENT_NOWIN32=
|
||||
\"${WINDOWS_CTEST_COMMAND}\"
|
||||
")
|
||||
|
||||
message("${WINDOWS_CTEST_COMMAND}")
|
||||
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/verify_tests.bat
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/verify_tests.bat" VERIFY_PATH)
|
||||
|
||||
add_custom_target(verify COMMAND "${VERIFY_PATH}"
|
||||
DEPENDS event ${ALL_TESTPROGS})
|
||||
else()
|
||||
# On some platforms doing exec(unset) as CMake does won't work, so make sure
|
||||
|
Loading…
x
Reference in New Issue
Block a user