2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
2013-07-22 21:52:26 +02:00
|
|
|
# WRITE THE run_pytriqs_for_test file
|
2013-07-23 20:57:53 +02:00
|
|
|
file (WRITE ${CMAKE_BINARY_DIR}/run_pytriqs_for_test.sh "#!/bin/bash\n export PYTHONPATH=${CMAKE_BINARY_DIR}/python:$PYTHONPATH\n ${TRIQS_PATH}/bin/pytriqs $@")
|
2013-07-22 21:52:26 +02:00
|
|
|
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run_pytriqs_for_test.sh)
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-07-22 21:52:26 +02:00
|
|
|
#SET(RUN_TEST @CMAKE_INSTALL_PREFIX@/bin/pytriqs)
|
2013-07-17 19:24:07 +02:00
|
|
|
SET(RUN_TEST ${CMAKE_BINARY_DIR}/run_pytriqs_for_test.sh )
|
|
|
|
#if (TRIQS_BUILD_STATIC)
|
|
|
|
# FILE(WRITE ${RUN_TEST} "PYTHONPATH=${CMAKE_BINARY_DIR}:$PYTHONPATH ${PYTHON_INTERPRETER} $1")
|
|
|
|
# #FILE(WRITE ${RUN_TEST} "PYTHONPATH=${CMAKE_BINARY_DIR}:$PYTHONPATH ${CMAKE_BINARY_DIR}/bin/pytriqs $1")
|
|
|
|
# execute_process( COMMAND chmod u+x ${RUN_TEST} )
|
|
|
|
#endif (TRIQS_BUILD_STATIC)
|
|
|
|
|
|
|
|
SET(ExecutableNameForTest ${RUN_TEST})
|
|
|
|
|
|
|
|
# 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 )
|
2013-07-17 19:24:07 +02:00
|
|
|
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)
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
# - 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)
|
2013-07-17 19:24:07 +02:00
|
|
|
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)
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|