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})
29 message(FATAL_ERROR
"${CAMITK_TEST_NAME}: input file ${CAMITK_TEST_PASS_FILE} not found." )
32 if (NOT EXISTS ${CAMITK_TEST_COMMAND_OUTPUT_FILE})
34 message(FATAL_ERROR
"${CAMITK_TEST_NAME}: output file ${CAMITK_TEST_COMMAND_OUTPUT_FILE} not found." )
37 # Then compare the files 38 message(
"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 )
47 message(FATAL_ERROR
"${CAMITK_TEST_NAME}: ${CAMITK_TEST_COMMAND_OUTPUT_FILE} does not match ${CAMITK_TEST_PASS_FILE}" )
get_filename_component(OUTFILE ${CAMITK_TEST_PASS_FILE} NAME) set(CAMITK_TEST_COMMAND_OUTPUT_FILE $
This CMake file run a command that is supposed to produce an output file, and then compare this outpu...
Definition: CamiTKTestCompareFile.h:13
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
test result execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f ${CAMITK_TEST_COMMAND_FILE} ${CAMITK_TEST_COMMAND_RESULT_FILE} ${CAMITK_TEST_COMMAND_OUTPUT_FILE} ${CAMITK_TEST_PASS_FILE_COMMAND_FILE} ${CAMITK_TEST_PASS_FILE_OUTPUT_FILE} ${CAMITK_TEST_PASS_FILE_RESULT_FILE}) file(WRITE $
Definition: CamiTKTestPassFile.h:21