3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 05:43:40 +01:00
dft_tools/cmake/run_test_simple.cmake
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

65 lines
1.6 KiB
CMake

## Useless, use run_test and suppress this
set (output_new ${CMAKE_CURRENT_BINARY_DIR}/${name}_output)
if (H5_DIFF_EXECUTABLE)
separate_arguments(H5_DIFF_OPTIONS)
separate_arguments(H5_DIFF_OBJECTS)
set (COM ${H5_DIFF_EXECUTABLE} ${H5_DIFF_EXCLUDE} ${H5_DIFF_OPTIONS} ${outputName} ${reference} ${H5_DIFF_OBJECTS})
else(H5_DIFF_EXECUTABLE)
set (COM ${CMAKE_COMMAND} -E compare_files ${output_new} ${reference})
endif (H5_DIFF_EXECUTABLE)
message(" command for the test ${cmd} ${input}")
if (input)
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE not_successful
INPUT_FILE ${input}
OUTPUT_FILE ${output_new}
ERROR_FILE ${output_new}.err
ERROR_VARIABLE err
TIMEOUT 600
)
else()
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE not_successful
OUTPUT_FILE ${output_new}
ERROR_FILE ${output_new}.err
ERROR_VARIABLE err
TIMEOUT 600
)
endif()
if(not_successful)
message(SEND_ERROR "error runing test '${name}': ${err}; command ${cmd} : shell output: ${not_successful}!")
endif(not_successful)
MESSAGE( "About to compare with ${COM}")
if (NOT H5_DIFF_EXECUTABLE)
# Little fix to turn -0 into 0 (--0 is not replaced)
FILE(READ ${output_new} temp)
STRING(REGEX REPLACE "([^-])-0([^.])" "\\10\\2" temp_after "${temp}")
FILE(WRITE ${output_new} ${temp_after})
endif()
execute_process(
COMMAND ${COM}
RESULT_VARIABLE not_successful
OUTPUT_VARIABLE out
ERROR_VARIABLE err
TIMEOUT 600
)
if(not_successful)
message(SEND_ERROR "output does not match for '${name}': ${err}; ${out}; shell output: ${not_successful}!")
endif(not_successful)
endif(output)
#file(REMOVE ${output_new})