Skip to content
Snippets Groups Projects
Commit 98e710fc authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon
Browse files

Added a CMake function to wrap python tests

parent c14137c3
No related branches found
No related tags found
1 merge request!165Added working python types test
...@@ -24,13 +24,16 @@ if(ADIOS2_HAVE_MPI) ...@@ -24,13 +24,16 @@ if(ADIOS2_HAVE_MPI)
endif() endif()
string(REGEX REPLACE "^${PYTHON_PREFIX}/" "" string(REGEX REPLACE "^${PYTHON_PREFIX}/" ""
python_package_dir "${PYTHON_SITE_PACKAGES}" CMAKE_INSTALL_PYTHONDIR "${PYTHON_SITE_PACKAGES}"
)
set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_PYTHONDIR}"
CACHE INTERNAL "" FORCE
) )
set_target_properties(adios2py PROPERTIES set_target_properties(adios2py PROPERTIES
OUTPUT_NAME adios2 OUTPUT_NAME adios2
LIBRARY_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${python_package_dir} LIBRARY_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}
RUNTIME_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${python_package_dir} RUNTIME_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}
) )
install(TARGETS adios2py install(TARGETS adios2py
DESTINATION ${python_package_dir} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}
) )
...@@ -37,3 +37,12 @@ function(message_pad msg out_len out_msg) ...@@ -37,3 +37,12 @@ function(message_pad msg out_len out_msg)
set(${out_msg} "${msg}${pad}" PARENT_SCOPE) set(${out_msg} "${msg}${pad}" PARENT_SCOPE)
endif() endif()
endfunction() endfunction()
function(python_add_test name script)
add_test(NAME ${name}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${script} ${ARGN}
)
set_property(TEST ${name} PROPERTY
ENVIRONMENT "PYTHONPATH=${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}"
)
endfunction()
...@@ -5,3 +5,4 @@ ...@@ -5,3 +5,4 @@
add_subdirectory(interface) add_subdirectory(interface)
add_subdirectory(engine) add_subdirectory(engine)
add_subdirectory(bindings)
#------------------------------------------------------------------------------#
# Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#
if(ADIOS2_HAVE_Python)
add_subdirectory(python)
endif()
#------------------------------------------------------------------------------#
# Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#
python_add_test(PythonBPWrite TestBPWriteTypes.py)
#!/usr/bin/env python
# #
# Distributed under the OSI-approved Apache License, Version 2.0. See # Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment