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]")
if(${CMAKE_VERSION} VERSION_GREATER "3.3" OR ${CMAKE_VERSION} VERSION_EQUAL "3.3") option(CAMITK_INCLUDE_WHAT_YOU_USE "Enable the header analysis on you code
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
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
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