14 set(CAMITK_TEST_COMMAND_OUTPUT_FILE ${CAMITK_TEST_OUTPUT_DIR}/${OUTFILE}) # the output of the tested command goes in
this files
16 # remove previous savings
17 execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f ${CAMITK_TEST_COMMAND_OUTPUT_FILE} )
19 # expands all arguments
20 set(CAMITK_TEST_COMMAND_ARG
"${CAMITK_TEST_COMMAND_ARG} -o ${CAMITK_TEST_OUTPUT_DIR}" )
#space before -o is important here #-o is the directory where the output file will be saved
21 string(REPLACE
" " "" CAMITK_TEST_COMMAND_ARG_LIST ${CAMITK_TEST_COMMAND_ARG})
24 execute_process(COMMAND ${CAMITK_TEST_COMMAND} ${CAMITK_TEST_COMMAND_ARG_LIST})
27 if (NOT EXISTS ${CAMITK_TEST_PASS_FILE})
28 message(STATUS
"[FAIL]")
29 message(FATAL_ERROR
"${CAMITK_TEST_NAME}: input file ${CAMITK_TEST_PASS_FILE} not found." )
32 if (NOT EXISTS ${CAMITK_TEST_COMMAND_OUTPUT_FILE})
33 message(STATUS
"[FAIL]")
34 message(FATAL_ERROR
"${CAMITK_TEST_NAME}: output file ${CAMITK_TEST_COMMAND_OUTPUT_FILE} not found." )
37 # Then compare the files
38 message(STATUS
"Comparing file \"${CAMITK_TEST_PASS_FILE}\" to \"${CAMITK_TEST_COMMAND_OUTPUT_FILE}\"...")
40 COMMAND ${CMAKE_COMMAND} -E compare_files ${CAMITK_TEST_PASS_FILE} ${CAMITK_TEST_COMMAND_OUTPUT_FILE}
41 RESULT_VARIABLE CAMITK_TEST_PASS_FILE_RESULT
45 if( CAMITK_TEST_PASS_FILE_RESULT )
46 message(STATUS
"[FAIL]")
47 message(FATAL_ERROR
"${CAMITK_TEST_NAME}: ${CAMITK_TEST_COMMAND_OUTPUT_FILE} does not match ${CAMITK_TEST_PASS_FILE}" )
49 message(STATUS
"[OK]")