Commit 5a502ae9 authored by Brian Panneton's avatar Brian Panneton Committed by Kenneth Leiter

Copied over testing suite that I made on an old Xdmf2 repo.

The testing suite should make it easier to add new tests. It also
makes use of a single .cmake.in file that gets reconfigured for
each test, instead of creating a new .cmake.in file for each test.
Look into the core/CMake/Use*.cmake files to see how to add new tests.
parent 6a10c125
SET(java_runtime @JAVA_RUNTIME@)
SET(java_binary_dir @CMAKE_CURRENT_BINARY_DIR@)
IF(WIN32)
STRING(REGEX REPLACE ":" ";" CLASSPATH ${CLASSPATH})
ENDIF(WIN32)
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}$ENV{LD_LIBRARY_PATH}")
SET(ENV{CLASSPATH} "${CLASSPATH}$ENV{CLASSPATH}")
MESSAGE("CALLING: ${java_runtime} ${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS(
COMMAND ${java_runtime} ${EXECUTABLE} ${ARGUMENTS}
WORKING_DIRECTORY ${java_binary_dir}
RESULT_VARIABLE java_result
OUTPUT_VARIABLE java_output
ERROR_VARIABLE java_error
)
MESSAGE("Result: ${java_result}")
MESSAGE("Output: ${java_output}")
MESSAGE("Error: ${java_error}")
IF(java_result)
MESSAGE(SEND_ERROR "${java_result}")
ENDIF(java_result)
SET(python_runtime @PYTHON_EXECUTABLE@)
SET(python_binary_dir @CMAKE_CURRENT_BINARY_DIR@)
IF(WIN32)
STRING(REGEX REPLACE ":" ";" PYTHONPATH ${PYTHONPATH})
ENDIF(WIN32)
SET(ENV{PYTHONPATH} "${PYTHONPATH}$ENV{PYTHONPATH}")
MESSAGE("CALLING: ${python_runtime} ${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS(
COMMAND ${python_runtime} ${EXECUTABLE}.pyc ${ARGUMENTS}
WORKING_DIRECTORY ${python_binary_dir}
RESULT_VARIABLE python_result
OUTPUT_VARIABLE python_output
ERROR_VARIABLE python_error
)
MESSAGE("Result: ${python_result}")
MESSAGE("Output: ${python_output}")
MESSAGE("Error: ${python_error}")
IF(python_result)
MESSAGE(SEND_ERROR "${python_result}")
ENDIF(python_result)
# List of global variables needed by tests
SET(defines
JAVA_TEST_DEPENDENCIES
JAVA_TEST_CLASSPATH
JAVA_TEST_LDPATH
JAVA_TEST_TARGETS
PYTHON_TEST_DEPENDENCIES
CXX_TEST_DEPENDENCIES
)
# Make sure they are defined
FOREACH(def IN LISTS defines)
GET_PROPERTY(is_defined GLOBAL PROPERTY ${def} DEFINED)
IF(NOT is_defined)
DEFINE_PROPERTY(GLOBAL PROPERTY ${def}
BRIEF_DOCS "${def}"
FULL_DOCS "${def} No Documentation"
)
ENDIF()
ENDFOREACH()
# We should have one place that points to the cxx source directory and the cxx
# binary directory
SET(cxx_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
SET(cxx_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
GET_PROPERTY(cxx_dependencies GLOBAL PROPERTY CXX_TEST_DEPENDENCIES)
# CXX Test Macro
# Author: Brian Panneton
# Description: This macro builds and add the cxx test in one shot.
# Parameters:
# executable = executable name
# ${ARGN} = any arguments for the executable
MACRO(ADD_CXX_TEST executable)
IF(EXISTS ${ARGN})
SET(arguments "${ARGN}")
ELSE(EXISTS ${ARGN}) # Sanity Check
SET(arguments "")
ENDIF(EXISTS ${ARGN})
IF(EXISTS ${cxx_source_dir}/${executable}.cpp)
ADD_EXECUTABLE(${executable} ${cxx_source_dir}/${executable}.cpp)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cpp)
IF(EXISTS ${cxx_source_dir}/${executable}.cxx)
ADD_EXECUTABLE(${executable} ${cxx_source_dir}/${executable}.cxx)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx)
TARGET_LINK_LIBRARIES(${executable} ${cxx_dependencies})
ADD_TEST(Cxx_${executable} ${executable} ${arguments})
ENDMACRO(ADD_CXX_TEST executable)
# Add a Java test
# One cannot simply do:
# SET(ENV{LD_LIBRARY_PATH} ${LIBRARY_OUTPUT_PATH})
# SET(my_test foo)
# ADD_TEST(JAVA_TEST_1 java ${my_test})
# Since cmake is only transmitting the ADD_TEST line to ctest thus you are loosing
# the env var. The only way to store the env var is to physically write in the cmake script
# whatever LD_LIBRARY_PATH you want and then add the test as 'cmake -P java_test.cmake'
#
# Usage:
# set (JAVA_TEST_DEPENDENCIES ${XDMF_CORE_JAVA_JAR} ${NETDMF_JAVA_JAR})
# set_source_files_properties(${test}.java PROPERTIES CLASSPATH "${XDMF_CORE_JAVA_JAR}:${NETDMF_JAVA_JAR}")
# set_source_files_properties(${test}.java PROPERTIES LDPATH "${CMAKE_BINARY_DIR}:${XDMF_LIBRARY_DIRS}")
# build_java_test(${test} ${test}.java ${JAVA_TEST_DEPENDENCIES})
# add_java_test(${test} ${test}.java)
INCLUDE(TestDefines)
# Variables that are set externally
SET(java_configure_files ${CMAKE_SOURCE_DIR}/core/CMake)
SET(java_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
SET(java_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
GET_PROPERTY(java_dependencies GLOBAL PROPERTY JAVA_TEST_DEPENDENCIES)
GET_PROPERTY(java_classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
GET_PROPERTY(java_ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
# Add Java Test Macro
# Author: Brian Panneton
# Description: This macro builds and adds the java test in one shot. There is
# no need to build a test separately, because there isn't a case
# that you don't want to run it.
# Parameters:
# executable = executable name
# ${ARGN} = any arguments for the executable
#
# Modified by Zacarias Ojeda <zojeda@gmail.com>
MACRO(ADD_JAVA_TEST executable)
IF(EXISTS ${ARGN})
SET(arguments "${ARGN}")
ELSE(EXISTS ${ARGN})
SET(arguments "")
ENDIF(EXISTS ${ARGN})
ADD_CUSTOM_COMMAND(
OUTPUT ${java_binary_dir}/${executable}.class
WORKING_DIRECTORY ${java_binary_dir}
DEPENDS ${java_source_dir}/${executable}.java
${java_dependencies}
COMMAND ${JAVA_COMPILE}
ARGS -cp ${java_classpath}
-d ${java_binary_dir}
${java_source_dir}/${executable}.java
)
SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_TARGETS "${java_binary_dir}/${executable}.class")
ADD_TEST(Java_${executable} ${CMAKE_COMMAND}
-D EXECUTABLE=${executable}
-D ARGUMENTS=${arguments}
-D CLASSPATH=${java_classpath}
-D LDPATH=${java_ldpath}
-P ${java_binary_dir}/JavaTestDriver.cmake
)
MACRO(BUILD_JAVA_TEST TESTNAME FILENAME DEPS)
GET_SOURCE_FILE_PROPERTY(src_file ${FILENAME} LOCATION)
GET_SOURCE_FILE_PROPERTY(classpath ${FILENAME} CLASSPATH)
GET_FILENAME_COMPONENT(FILENAME_BASE ${src_file} NAME_WE)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME_BASE}.class
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${JAVA_COMPILE}
ARGS ${src_file} -d ${CMAKE_CURRENT_BINARY_DIR} -cp ${classpath} ${wo_semicolumn}
DEPENDS ${FILENAME} ${DEPS}
)
ADD_CUSTOM_TARGET("${FILENAME_BASE}_target" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME_BASE}.class)
ENDMACRO(BUILD_JAVA_TEST TESTNAME FILENAME)
MACRO(ADD_JAVA_TEST TESTNAME FILENAME)
GET_SOURCE_FILE_PROPERTY(loc ${FILENAME} LOCATION)
GET_SOURCE_FILE_PROPERTY(classpath ${FILENAME} CLASSPATH)
GET_SOURCE_FILE_PROPERTY(ldpath ${FILENAME} LDPATH)
GET_SOURCE_FILE_PROPERTY(args ${FILENAME} ARGS)
GET_FILENAME_COMPONENT(loc2 ${loc} NAME_WE)
IF (NOT args)
SET(args "")
ENDIF (NOT args)
STRING(REGEX REPLACE ";" " " wo_semicolumn "${ARGN}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}.cmake
"
SET(ENV{LD_LIBRARY_PATH} ${ldpath}:$ENV{LD_LIBRARY_PATH})
MESSAGE("Running Compiled File" )
EXECUTE_PROCESS(
COMMAND ${JAVA_RUNTIME} -cp .:${classpath} ${loc2} ${args}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
RESULT_VARIABLE my_result
OUTPUT_VARIABLE my_output
ERROR_VARIABLE my_error
)
MESSAGE(\"result is \${my_result}\")
MESSAGE(\"output is \${my_output}\")
MESSAGE(\"error is \${my_error}\")
if(my_result)
MESSAGE(SEND_ERROR "\${result}")
endif(my_result)
"
)
ADD_TEST(${TESTNAME} ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}.cmake)
ENDMACRO(ADD_JAVA_TEST)
# Configure the java 'driver' file
CONFIGURE_FILE(${java_configure_files}/JavaTestDriver.cmake.in ${java_binary_dir}/JavaTestDriver.cmake @ONLY)
# Add a python test from a python file
# One cannot simply do:
# SET(ENV{PYTHONPATH} ${LIBRARY_OUTPUT_PATH})
# SET(my_test "from test_mymodule import *\;test_mymodule()")
# ADD_TEST(PYTHON-TEST-MYMODULE python -c ${my_test})
# Since cmake is only transmitting the ADD_TEST line to ctest thus you are loosing
# the env var. The only way to store the env var is to physically write in the cmake script
# whatever PYTHONPATH you want and then add the test as 'cmake -P python_test.cmake'
#
# Usage:
# SET_SOURCE_FILES_PROPERTIES(test.py PROPERTIES PYTHONPATH
# "${LIBRARY_OUTPUT_PATH}:${VTK_DIR}")
# ADD_PYTHON_TEST(PYTHON-TEST test.py)
# We cannot call ${PYTHON_EXECUTABLE} or ${PYTHON_LIBRARIES} because
# they do not get propagated down to this subdirectory
SET(PYTHON_EXECUTABLE python)
# Need python interpreter:
FIND_PACKAGE(PythonInterp REQUIRED)
# Variables that are set externally
SET(python_configure_files ${CMAKE_SOURCE_DIR}/core/CMake)
SET(python_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
SET(python_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
GET_PROPERTY(python_dependencies GLOBAL PROPERTY PYTHON_TEST_DEPENDENCIES)
GET_PROPERTY(python_pythonpath GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH)
# Add Python Test Macro
# Author: Brian Panneton
# Description: This macro compiles and adds the python test in one shot. There is
# no need to build a test separately, because there isn't a case
# that you don't want to run it.
# Parameters:
# executable = executable name
# ${ARGN} = any arguments for the executable
#
MACRO(ADD_PYTHON_TEST executable)
IF(EXISTS ${ARGN})
SET(arguments "${ARGN}")
ELSE(EXISTS ${ARGN})
SET(arguments "")
ENDIF(EXISTS ${ARGN})
ADD_CUSTOM_COMMAND(
OUTPUT ${python_binary_dir}/${executable}.pyc
WORKING_DIRECTORY ${python_binary_dir}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
${python_source_dir}/${executable}.py
${python_binary_dir}/${executable}.py
COMMAND ${PYTHON_EXECUTABLE}
ARGS -mpy_compile
${python_binary_dir}/${executable}.py
DEPENDS ${python_source_dir}/${executable}.py
${python_dependencies}
)
SET_PROPERTY(GLOBAL APPEND PROPERTY PYTHON_TEST_TARGETS "${python_binary_dir}/${executable}.pyc")
ADD_TEST(Python_${executable} ${CMAKE_COMMAND}
-D EXECUTABLE=${executable}
-D ARGUMENTS=${arguments}
-D PYTHONPATH=${python_pythonpath}
-P ${python_binary_dir}/PythonTestDriver.cmake
)
MACRO(ADD_PYTHON_TEST TESTNAME FILENAME)
GET_SOURCE_FILE_PROPERTY(loc ${FILENAME} LOCATION)
GET_SOURCE_FILE_PROPERTY(pyenv ${FILENAME} PYTHONPATH)
STRING(REGEX REPLACE ";" " " wo_semicolumn "${ARGN}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}.cmake
"
SET(ENV{PYTHONPATH} ${pyenv})
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} ${loc} ${wo_semicolumn}
#WORKING_DIRECTORY @LIBRARY_OUTPUT_PATH@
RESULT_VARIABLE import_res
OUTPUT_VARIABLE import_output
ERROR_VARIABLE import_output
)
# Pass the output back to ctest
#MESSAGE("\${import_output}")
IF(import_res)
MESSAGE(SEND_ERROR "\${import_res}")
ENDIF(import_res)
"
)
ADD_TEST(${TESTNAME} cmake -P ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}.cmake)
ENDMACRO(ADD_PYTHON_TEST)
# Byte compile recursively a directory (DIRNAME)
MACRO(ADD_PYTHON_COMPILEALL_TEST DIRNAME)
# First get the path:
GET_FILENAME_COMPONENT(temp_path "${PYTHON_LIBRARIES}" PATH)
# Find the python script:
GET_FILENAME_COMPONENT(PYTHON_COMPILE_ALL_PY "${temp_path}/../compileall.py" ABSOLUTE)
# add test, use DIRNAME to create uniq name for the test:
ADD_TEST(COMPILE_ALL-${DIRNAME} ${PYTHON_EXECUTABLE} "${PYTHON_COMPILE_ALL_PY}" -q ${DIRNAME})
ENDMACRO(ADD_PYTHON_COMPILEALL_TEST)
# Configure the python 'driver' file
CONFIGURE_FILE(${python_configure_files}/PythonTestDriver.cmake.in ${python_binary_dir}/PythonTestDriver.cmake @ONLY)
set(XdmfCoreCxxTests
TestXdmfArray
TestXdmfArrayWriteRead
TestXdmfHDF5Controller
TestXdmfHDF5Writer
TestXdmfInformation
# Add any dependencies that the cxx core tests may need
# Note: The tests already depend on their own file
SET_PROPERTY(GLOBAL APPEND PROPERTY CXX_TEST_DEPENDENCIES
"XdmfCore"
)
foreach(test ${XdmfCoreCxxTests})
add_executable(${test} ${test})
target_link_libraries(${test} XdmfCore)
add_test(${test} ${test})
endforeach(test ${XdmfCoreCxxTests})
# Include our test macros
include (UseCxxTest)
# Add any cxx tests here:
# Note: We don't want to use a foreach loop to test the files incase we
# have extra arguments (id: ADD_CXX_TEST(testname inputfile))
# Read UseCxxTest.cmake for more information
# ---------------------------------------
ADD_CXX_TEST(TestXdmfArray)
ADD_CXX_TEST(TestXdmfArrayWriteRead)
ADD_CXX_TEST(TestXdmfHDF5Controller)
ADD_CXX_TEST(TestXdmfHDF5Writer)
ADD_CXX_TEST(TestXdmfInformation)
#Add any dependencies that the java core tests may need
# Note: The tests already depend on their own file
SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_DEPENDENCIES
"${XDMF_CORE_JAVA_JAR}"
)
# Add any classpath directories that the java tests may need
# Note: JAVA_TEST_CLASSPATH is also set in core
GET_PROPERTY(java_classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_CLASSPATH
".:${XDMF_CORE_JAVA_JAR}"
)
# Add any ldpath directories that the java tests may need
# Note: JAVA_TEST_LDPATH is also set in core
GET_PROPERTY(java_ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_LDPATH
"${CMAKE_BINARY_DIR}"
)
# Include our test macros
include (UseJavaTest)
# Add any java tests here:
# Note: We don't want to use a foreach loop to test the files incase we
# have extra arguments (ie: ADD_JAVA_TEST(testname inputfile))
# Read UseJavaTest.cmake for more information
# ------------------------
# none
# Add a custom target for all java tests
# Note: ${TARGETS} is set in ADD_JAVA_TEST
GET_PROPERTY(targets GLOBAL PROPERTY JAVA_TEST_TARGETS)
ADD_CUSTOM_TARGET(Java_Core_Test_target ALL DEPENDS ${targets})
include(UsePythonTest)
# Add any dependencies that the python tests may need
# Note: The tests already depend on their own file
SET_PROPERTY(GLOBAL APPEND PROPERTY PYTHON_TEST_DEPENDENCIES
)
set(XdmfCorePythonTests
TestXdmfArray.py
# Add any pythonpath directories that the python tests may need
GET_PROPERTY(python_pythonpath GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH)
SET_PROPERTY(GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH
"${CMAKE_BINARY_DIR}:"
)
foreach(test ${XdmfCorePythonTests})
set_source_files_properties(${test} PROPERTIES PYTHONPATH "${CMAKE_BINARY_DIR}")
add_python_test(${test} ${test})
endforeach(test ${XdmfCorePythonTests})
# Include our test macros
include(UsePythonTest)
# Add any python tests here:
# Note: we don't want to use a foreach loop to test the files incase we
# have extra arguments (ie: ADD_PYTHON_TEST(testname inputfile))
# Read UsePythonTest.cmake for more information
# ---------------------
ADD_PYTHON_TEST(TestXdmfArray)
# Add a custom target for all python tests
# Note: ${TARGETS} is set in ADD_PYTHON_TEST
GET_PROPERTY(targets GLOBAL PROPERTY PYTHON_TEST_TARGETS)
ADD_CUSTOM_TARGET(Python_Core_Test_target ALL DEPENDS ${targets})
# We need to reset the targests since we created a core target
SET_PROPERTY(GLOBAL PROPERTY PYTHON_TEST_TARGETS "")
set(XdmfCxxTests
TestXdmfAttribute
TestXdmfGeometry
TestXdmfGrid
TestXdmfGridCollection
TestXdmfMap
TestXdmfReader
TestXdmfSet
TestXdmfTime
TestXdmfTopology
TestXdmfVisitorValueCounter
TestXdmfWriter
TestXdmfWriterHDF5ThenXML
TestXdmfXPath
# Add any dependencies that the cxx core tests may need
# Note: The tests already depend on their own file
SET_PROPERTY(GLOBAL APPEND PROPERTY CXX_TEST_DEPENDENCIES
"Xdmf"
)
foreach(test ${XdmfCxxTests})
add_executable(${test} ${test})
target_link_libraries(${test} Xdmf)
add_test(${test} ${test})
endforeach(test ${XdmfCxxTests})
# Include our test macros
include (UseCxxTest)
# Add any cxx tests here:
# Note: We don't want to use a foreach loop to test the files incase we
# have extra arguments (id: ADD_CXX_TEST(testname inputfile))
# Read UseCxxTest.cmake for more information
# ---------------------------------------
ADD_CXX_TEST(TestXdmfAttribute)
ADD_CXX_TEST(TestXdmfGeometry)
ADD_CXX_TEST(TestXdmfGrid)
ADD_CXX_TEST(TestXdmfGridCollection)
ADD_CXX_TEST(TestXdmfReader)
ADD_CXX_TEST(TestXdmfSet)
ADD_CXX_TEST(TestXdmfTime)
ADD_CXX_TEST(TestXdmfTopology)
ADD_CXX_TEST(TestXdmfVisitorValueCounter)
ADD_CXX_TEST(TestXdmfWriter)
ADD_CXX_TEST(TestXdmfWriterHDF5ThenXML)
ADD_CXX_TEST(TestXdmfXPath)
set(XdmfJavaTests
TestXdmfJava
# Add any dependencies that the java tests may need
# Note: The tests already depend on their own file
# JAVA_TEST_DEPENDENCIES is also set in core
SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_DEPENDENCIES
${XDMF_JAVA_JAR}
)
# Add any classpath directories that the java tests may need
# Note: JAVA_TEST_CLASSPATH is also set in core
GET_PROPERTY(java_classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_CLASSPATH
"${java_classpath}:${XDMF_JAVA_JAR}"
)
# Add any ldpath directories that the java tests may need
# Note: JAVA_TEST_LDPATH is also set in core
GET_PROPERTY(java_ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_LDPATH
"${java_ldpath}:"
)
# Include our test macros
include (UseJavaTest)
set(JAVA_TEST_DEPENDENCIES ${XDMF_CORE_JAVA_JAR} ${XDMF_JAVA_JAR})
foreach (test ${XdmfJavaTests})
set_source_files_properties(${test}.java PROPERTIES CLASSPATH "${XDMF_CORE_JAVA_JAR}:${XDMF_JAVA_JAR}")
set_source_files_properties(${test}.java PROPERTIES LDPATH "${CMAKE_BINARY_DIR}")
build_java_test(${test} ${test}.java ${JAVA_TEST_DEPENDENCIES})
add_java_test(${test} ${test}.java)
endforeach (test ${XdmfJavaTests})
# Add any java tests here:
# Note: We don't want to use a foreach loop to test the files incase we
# have extra arguments (ie: ADD_JAVA_TEST(testname inputfile))
# Read UseJavaTest.cmake for more information
# ------------------------
ADD_JAVA_TEST(TestXdmfJava)
# Add a custom target for all java tests
# Note: ${TARGETS} is set in ADD_JAVA_TEST
IF(EXISTS Java_Core_Test_target)
SET(Java_Core_Test_target Java_Core_Test_target)
ENDIF(EXISTS Java_Core_Test_target)
GET_PROPERTY(targets GLOBAL PROPERTY JAVA_TEST_TARGETS)
ADD_CUSTOM_TARGET(Java_ALLTEST ALL DEPENDS ${Java_Core_Test_target} ${targets})
include(UsePythonTest)
# Add any dependencies that the python tests may need
# Note: The tests already depend on their own file
# PYTHON_TEST_DEPENDENCIES is also set in core
SET_PROPERTY(GLOBAL APPEND PROPERTY PYTHON_TEST_DEPENDENCIES
""
)
set(XdmfPythonTests
TestXdmfHDF5Writer.py
TestXdmfSet.py
TestXdmfWriter.py
# Add any pythonpath directories that the python tests may need
# Note: PYTHON_TEST_PYTHONPATH is also set in core
GET_PROPERTY(python_pythonpath GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH)
SET_PROPERTY(GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH
"${python_pythonpath}:"
)
foreach(test ${XdmfPythonTests})
set_source_files_properties(${test} PROPERTIES PYTHONPATH "${CMAKE_BINARY_DIR}")
add_python_test(${test} ${test})
endforeach(test ${XdmfPythonTests})
# Include our test macros
include(UsePythonTest)
# Add any python tests here:
# Note: We don't want to use a foreach loop to test the files incase we
# have extra arguments (ie: ADD_PYTHON_TEST(testname inputfile))
# Read UsePythonTest.cmake for more information
# -----------------------
ADD_PYTHON_TEST(TestXdmfHDF5Writer)
ADD_PYTHON_TEST(TestXdmfWriter)
# Add a custom target for all python tests
# Note: ${TARGETS} is set in ADD_PYTHON_TEST
IF(EXISTS Python_Core_Test_target)
SET(Python_Core_Test_target Python_Core_Test_target)
ENDIF(EXISTS Python_Core_Test_target)
GET_PROPERTY(targets GLOBAL PROPERTY PYTHON_TEST_TARGETS)
ADD_CUSTOM_TARGET(Python_ALLTEST ALL DEPENDS ${Python_Core_Test_target} ${targets})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment