3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 06:43:40 +01:00
dft_tools/cmake/FindTriqsTest.cmake.in

94 lines
3.2 KiB
CMake
Raw Normal View History

# runs python_with_DMFT script > output
# and compares output with script.output
# Example:
# triqs_add_triqs_test_script(ExampleTest)
# where ExampleTest.py is the script and ExampleTest.output is the expected output
#
macro(triqs_add_test_C_simple testname )
enable_testing()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}${ARGN}
-Dcmd=${CMAKE_CURRENT_BINARY_DIR}/${testname}${ARGN}
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
add_test(${testname}${ARGN} ${testname}${ARGN} )
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
endmacro(triqs_add_test_C_simple)
macro(triqs_add_test_C_hdf testname h5diff_options)
set(h5diff_objects ${ARGN}) # grab additionnal arguments !
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}${ARGN}
-Dcmd=${CMAKE_CURRENT_BINARY_DIR}/${testname}${ARGN}
-DoutputName=${testname}.output.h5
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output.h5
-DH5_DIFF_EXECUTABLE=${TRIQS_HDF5_DIFF_EXECUTABLE}
-DH5_DIFF_OPTIONS=${h5diff_options}
-DH5_DIFF_OBJECTS=${h5diff_objects}
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
endmacro(triqs_add_test_C_hdf)
SET(ExecutableNameForTest ${CMAKE_BINARY_DIR}/build_pytriqs)
# runs pytriqs script > output
# and compares output with script.output
# Example:
# triqs_add_triqs_test_script(ExampleTest)
# where ExampleTest.py is the script and ExampleTest.output is the expected output
#
2013-07-23 20:57:53 +02:00
macro(triqs_add_test_txt testname )
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}
-Dcmd=${ExecutableNameForTest}
-Dinput=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.py
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
2013-07-23 20:57:53 +02:00
endmacro(triqs_add_test_txt)
# - runs python_with_DMFT script
# - compares the file named testname_output.h5
# with the file testname.output.h5 of the source directory
# The comparison with made with h5diff_options
# all remainings arguments are the objects to which to restrict the comparison (default = no restriction)
# Example :
# triqs_add_triqs_test_hdf(ExampleTestH5 "-r" )
# where ExampleTestH5.py produces to be compared with ExampleTestH5_output.h5 with option "-r" and for all objects
#
2013-07-23 20:57:53 +02:00
macro(triqs_add_test_hdf testname h5diff_options)
set(h5diff_objects ${ARGN}) # grab additionnal arguments !
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}
-Dcmd=${ExecutableNameForTest}
-Dinput=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.py
-DoutputName=${testname}.output.h5
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output.h5
-DH5_DIFF_EXECUTABLE=${TRIQS_HDF5_DIFF_EXECUTABLE}
-DH5_DIFF_OPTIONS=${h5diff_options}
-DH5_DIFF_OBJECTS=${h5diff_objects}
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
2013-07-23 20:57:53 +02:00
endmacro(triqs_add_test_hdf)