# runTest.cmake executes a command and captures the output in a file. File is then compared
# against a reference file. Exit status of command can also be compared.
cmake_policy(SET CMP0007 NEW)
message (FATAL_ERROR "Require TEST_TESTER to be defined")
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
if (NOT TEST_LIBRARY_DIRECTORY)
message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined")
endif (NOT TEST_LIBRARY_DIRECTORY)
message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
message (STATUS "Require TEST_CLASSPATH to be defined")
endif (NOT TEST_CLASSPATH)
message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
endif (NOT TEST_REFERENCE)
else (NOT TEST_LOG_LEVEL)
set (LOG_LEVEL "${TEST_LOG_LEVEL}")
endif (NOT TEST_LOG_LEVEL)
message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}")
set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}")
endif (WIN32 AND NOT MINGW)
# run the test program, capture the stdout/stderr and the result var
COMMAND ${TEST_TESTER} -Xmx1024M
-Dorg.slf4j.simpleLogger.defaultLogLevel=${LOG_LEVEL}
-Djava.library.path=${TEST_LIBRARY_DIRECTORY}
-cp "${TEST_CLASSPATH}" ${TEST_ARGS} ${TEST_PROGRAM}
WORKING_DIRECTORY ${TEST_FOLDER}