Skip to content
Snippets Groups Projects
Unverified Commit 8f29ee23 authored by René Milk's avatar René Milk Committed by GitHub
Browse files

Merge pull request #51 from dune-community/travis_test_bindings

Travis test bindings
parents 12c63a3d 54c1bbaa
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#
# This file is part of the dune-xt-common project:
# https://github.com/dune-community/dune-xt-common
# Copyright 2009-2018 dune-xt-common developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# Authors:
# Felix Schindler (2017)
# Rene Milk (2017 - 2018)
# ****** THIS FILE IS AUTOGENERATED, DO NOT EDIT **********
# this file is treated as a jinja2 template
......
#!/usr/bin/env python3
#
# This file is part of the dune-xt-common project:
# https://github.com/dune-community/dune-xt-common
# Copyright 2009-2018 dune-xt-common developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# Authors:
# Rene Milk (2017 - 2018)
import os
from os.path import expanduser
......
#!/bin/bash
#
# This file is part of the dune-xt-common project:
# https://github.com/dune-community/dune-xt-common
# Copyright 2009-2018 dune-xt-common developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# Authors:
# Felix Schindler (2017)
# Rene Milk (2017 - 2018)
# ****** THIS FILE IS AUTOGENERATED, DO NOT EDIT **********
# this file is treated as a jinja2 template
......
#!/bin/bash
# ****** THIS FILE IS AUTOGENERATED, DO NOT EDIT **********
# this file is treated as a jinja2 template
set -e
set -x
WAIT="${SUPERDIR}/scripts/bash/travis_wait_new.bash 45"
source ${SUPERDIR}/scripts/bash/retry_command.bash
${SRC_DCTRL} ${BLD} --only=${MY_MODULE} configure
${SRC_DCTRL} ${BLD} --only=${MY_MODULE} bexec ${BUILD_CMD}
${WAIT} ${SRC_DCTRL} ${BLD} --only=${MY_MODULE} bexec ninja -j1 -v bindings
${WAIT} ${SRC_DCTRL} ${BLD} --only=${MY_MODULE} bexec ninja -j1 -v test_python
# ****** THIS FILE IS AUTOGENERATED, DO NOT EDIT **********
\ No newline at end of file
# This file is part of the dune-xt-common project:
# https://github.com/dune-community/dune-xt-common
# Copyright 2009-2018 dune-xt-common developers and contributors. All rights reserved.
# Copyright 2009-2017 dune-xt-functions developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# Authors:
# Felix Schindler (2015 - 2017)
# Rene Milk (2015 - 2018)
# Tobias Leibner (2015 - 2016)
#
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# Felix Schindler (2016 - 2017)
# Rene Milk (2016 - 2017)
# Tobias Leibner (2016)
sudo: required
# THIS FILE IS AUTOGENERATED -- DO NOT EDIT #
# Re-run .ci/templates/update.py --nd instead #
sudo: false
dist: trusty
language: generic
services: docker
before_script:
- export IMAGE="dunecommunity/${MY_MODULE}-testing_${DOCKER_TAG}:${TRAVIS_BRANCH}"
- export IMAGE="dunecommunity/dune-xt-common-testing_${DOCKER_TAG}:${TRAVIS_BRANCH}"
# get image with fallback to master branch of the super repo
- docker pull ${IMAGE} || export IMAGE="dunecommunity/${MY_MODULE}-testing_${DOCKER_TAG}:master" ; docker pull ${IMAGE}
- docker pull ${IMAGE} || export IMAGE="dunecommunity/dune-xt-common-testing_${DOCKER_TAG}:master" ; docker pull ${IMAGE}
- export ENV_FILE=${HOME}/env
- python3 ./.travis.make_env_file.py
- export DOCKER_RUN="docker run --env-file ${ENV_FILE} -v ${TRAVIS_BUILD_DIR}:/root/src/${MY_MODULE} ${IMAGE}"
- export MY_MODULE=dune-xt-common
- export DOCKER_RUN="docker run --env-file ${ENV_FILE} -v ${TRAVIS_BUILD_DIR}:/root/src/dune-xt-common ${IMAGE}"
script:
- ${DOCKER_RUN} /root/src/${MY_MODULE}/.travis.script.bash
- ${DOCKER_RUN} /root/src/dune-xt-common/.travis.script.bash
# runs independent of 'script' failure/success
after_script:
- ${DOCKER_RUN} /root/src/${MY_MODULE}/.travis.after_script.bash
- ${DOCKER_RUN} /root/src/dune-xt-common/.travis.after_script.bash
# output for simpler replicability
- docker images ${IMAGE}
- echo ${DOCKER_RUN}
......@@ -48,13 +51,40 @@ branches:
except:
- gh-pages
env:
global:
- MY_MODULE=dune-xt-common
stages:
- Test C++
- Test Python Bindings
matrix:
jobs:
include:
- env: DOCKER_TAG=gcc_full
- env: DOCKER_TAG=gcc_no_istl_no_disc
- env: DOCKER_TAG=gcc_no_disc
- env: DOCKER_TAG=clang_full
\ No newline at end of file
- stage: test_cpp
env: DOCKER_TAG=gcc_full
- stage: test_cpp
env: DOCKER_TAG=gcc_no_istl_no_disc
- stage: test_cpp
env: DOCKER_TAG=gcc_no_disc
- stage: test_cpp
env: DOCKER_TAG=clang_full
- stage: test_python
env: DOCKER_TAG=gcc_full
script: ${DOCKER_RUN} /root/src/dune-xt-common/.travis.test_python.bash
# overwrite other global/matrix settings
after_script: true
- stage: test_python
env: DOCKER_TAG=gcc_no_istl_no_disc
script: ${DOCKER_RUN} /root/src/dune-xt-common/.travis.test_python.bash
# overwrite other global/matrix settings
after_script: true
- stage: test_python
env: DOCKER_TAG=gcc_no_disc
script: ${DOCKER_RUN} /root/src/dune-xt-common/.travis.test_python.bash
# overwrite other global/matrix settings
after_script: true
- stage: test_python
env: DOCKER_TAG=clang_full
script: ${DOCKER_RUN} /root/src/dune-xt-common/.travis.test_python.bash
# overwrite other global/matrix settings
after_script: true
# THIS FILE IS AUTOGENERATED -- DO NOT EDIT #
# Re-run .ci/templates/update.py --nd instead #
\ No newline at end of file
......@@ -39,32 +39,6 @@ endif ( DEFINED dune-xt-common_MODULE_PATH )
enable_testing()
macro(dxt_headercheck_target_name arg)
string(REGEX REPLACE ".*/([^/]*)" "\\1" simple ${arg})
string(REPLACE ${PROJECT_SOURCE_DIR} "" rel ${arg})
string(REGEX REPLACE "(.*)/[^/]*" "\\1" relpath ${rel})
string(REGEX REPLACE "/" "_" targname ${rel})
set(targname "headercheck_${targname}")
endmacro(dxt_headercheck_target_name)
macro(get_headercheck_targets)
# this is mostly c&p from dune-common, since we need a way to extract
# all target names to pass to our load balancing script
if(ENABLE_HEADERCHECK)
get_property(headerlist GLOBAL PROPERTY headercheck_list)
foreach(header ${headerlist})
list (FIND dxt_ignore_header "${header}" _index)
if (${_index} GREATER -1)
continue()
endif()
#do some name conversion
set(targname ${header})
dxt_headercheck_target_name(${targname})
list(APPEND dxt_headercheck_targets "${targname}")
endforeach(header ${headerlist})
endif(ENABLE_HEADERCHECK)
endmacro(get_headercheck_targets)
find_package(Qhull)
find_package(LPSolve)
find_package(MKL)
......@@ -73,146 +47,7 @@ find_package(MatExp)
find_package(Fekete)
find_package(LebedevData)
macro(BEGIN_TESTCASES)
# https://cmake.org/cmake/help/v3.0/module/FindGTest.html http://purplekarrot.net/blog/cmake-and-test-suites.html
file( GLOB_RECURSE test_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cc" )
foreach( source ${test_sources} )
set(ranks "1")
if( source MATCHES "mpi" )
list(APPEND ranks ${DUNE_MAX_TEST_CORES})
endif( source MATCHES "mpi" )
get_filename_component(testbase ${source} NAME_WE)
string(REPLACE ".cc" ".mini" minifile ${source})
if( EXISTS ${minifile} )
dune_add_system_test(SOURCE ${source} ${COMMON_HEADER}
INIFILE ${minifile}
BASENAME test_${testbase}
CREATED_TARGETS targetlist_${testbase}
ADDED_TESTS testlist_${testbase}
SCRIPT dune_xt_execute.py
${DEBUG_MACRO_TESTS})
foreach(target ${targetlist_${testbase}})
target_link_libraries( ${target} ${ARGN} ${COMMON_LIBS} ${GRID_LIBS} gtest_dune_xt_common )
list(APPEND dxt_test_binaries ${target} )
set(dxt_test_names_${target} ${testlist_${testbase}_${target}})
endforeach(target)
else( EXISTS ${minifile} )
set(target test_${testbase})
dune_add_test( NAME ${target}
SOURCES ${source} ${COMMON_HEADER}
LINK_LIBRARIES ${ARGN} ${COMMON_LIBS} ${GRID_LIBS} gtest_dune_xt_common
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target}
--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/${target}.xml
TIMEOUT ${DXT_TEST_TIMEOUT}
MPI_RANKS ${ranks})
list(APPEND dxt_test_binaries ${target} )
set(dxt_test_names_${target} ${target})
endif( EXISTS ${minifile} )
endforeach( source )
file( GLOB_RECURSE test_templates "${CMAKE_CURRENT_SOURCE_DIR}/*.tpl" )
foreach( template ${test_templates} )
set(ranks "1")
if( template MATCHES "mpi" )
list(APPEND ranks ${DUNE_MAX_TEST_CORES})
endif( template MATCHES "mpi" )
get_filename_component(testbase ${template} NAME_WE)
string(REPLACE ".tpl" ".py" config_fn "${template}")
string(REPLACE ".tpl" ".tpl.cc" out_fn "${template}")
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" out_fn "${out_fn}")
# get the last completed cache for the codegen execution during configure time
foreach(_mod ${ALL_DEPENDENCIES} )
dune_module_path(MODULE ${_mod} RESULT ${_mod}_binary_dir BUILD_DIR)
if(IS_DIRECTORY ${${_mod}_binary_dir})
set(last_dep_bindir ${${_mod}_binary_dir})
endif()
endforeach(_mod DEPENDENCIES)
dune_xt_execute_process(COMMAND ${CMAKE_BINARY_DIR}/dune-env dxt_code_generation.py
"${config_fn}" "${template}" "${CMAKE_CURRENT_BINARY_DIR}"
"${out_fn}" "${last_dep_bindir}")
file( GLOB generated_sources "${out_fn}.*")
if("" STREQUAL "${generated_sources}")
set(generated_sources ${out_fn})
endif()
add_custom_command(OUTPUT "${generated_sources}"
COMMAND ${CMAKE_BINARY_DIR}/dune-env dxt_code_generation.py
"${config_fn}" "${template}" "${CMAKE_CURRENT_BINARY_DIR}"
"${out_fn}" "${last_dep_bindir}"
DEPENDS "${config_fn}" "${template}"
VERBATIM USES_TERMINAL)
foreach(gen_source ${generated_sources})
string(REPLACE "${out_fn}." "" postfix "${gen_source}")
string(REPLACE "${out_fn}" "" postfix "${postfix}")
string(REPLACE ".cc" "" postfix "${postfix}")
if(NOT "" STREQUAL "${postfix}")
set(postfix "__${postfix}")
endif()
set(target test_${testbase}${postfix})
dune_add_test( NAME ${target}
SOURCES ${gen_source} ${COMMON_HEADER}
LINK_LIBRARIES ${ARGN} ${COMMON_LIBS} ${GRID_LIBS} gtest_dune_xt_common
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target}
--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/${target}.xml
TIMEOUT ${DXT_TEST_TIMEOUT}
MPI_RANKS ${ranks})
list(APPEND dxt_test_binaries ${target} )
set(dxt_test_names_${target} ${target})
endforeach()
endforeach( template ${test_templates} )
add_custom_target(test_templates SOURCES ${test_templates})
endmacro(BEGIN_TESTCASES)
macro(END_TESTCASES)
# this excludes meta-ini variation test cases because
# there binary name != test name
foreach( test ${dxt_test_binaries} )
if (TARGET test)
set_tests_properties(${test} PROPERTIES TIMEOUT ${DXT_TEST_TIMEOUT})
endif(TARGET test)
endforeach( test ${dxt_test_binaries} )
add_custom_target(test_binaries DEPENDS ${dxt_test_binaries})
# add_dependencies(test test_binaries)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${DXT_TEST_TIMEOUT} -j ${DXT_TEST_PROCS}
DEPENDS test_binaries USES_TERMINAL)
add_custom_target(recheck COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${DXT_TEST_TIMEOUT} --rerun-failed -j ${DXT_TEST_PROCS}
DEPENDS test_binaries USES_TERMINAL)
foreach (target ${dxt_test_binaries})
set(all_sorted_testnames "${all_sorted_testnames}/${dxt_test_names_${target}}")
endforeach (target ${dxt_test_binaries})
set(dxt_headercheck_targets "")
get_headercheck_targets(dxt_headercheck_targets)
configure_file(${dune-xt-common-module-path}/dxt_test_binaries.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dxt_test_binaries.cmake)
configure_file(${dune-xt-common-module-path}/dxt_all_sorted_testnames.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dxt_all_sorted_testnames.cmake)
configure_file(${dune-xt-common-module-path}/dxt_headercheck_targets.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dxt_headercheck_targets.cmake)
add_custom_target(rerun_test_distribution ${CMAKE_BINARY_DIR}/dune-env distribute_testing.py
"${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/dxt_test_binaries.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dxt_all_sorted_testnames.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dxt_headercheck_targets.cmake"
"${DXT_BIN_COUNT}"
VERBATIM USES_TERMINAL)
add_custom_target(copy_builders_if_different
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/builder_definitions.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/builder_definitions.cmake")
add_custom_target(refresh_test_timings)
add_dependencies(copy_builders_if_different rerun_test_distribution)
add_dependencies(refresh_test_timings copy_builders_if_different)
endmacro(END_TESTCASES)
macro(dxt_exclude_from_headercheck)
exclude_from_headercheck(${ARGV0})
#make this robust to argument being passed with or without ""
string(REGEX REPLACE "[\ \n]+([^\ ])" ";\\1" list ${ARGV0})
set(list "${list};${ARGV}")
foreach(item ${list})
set(item ${CMAKE_CURRENT_SOURCE_DIR}/${item})
list(APPEND dxt_ignore_header ${item})
endforeach()
endmacro(dxt_exclude_from_headercheck)
include(DuneXTTesting)
macro(add_header_listing)
# header
......
macro(dxt_headercheck_target_name arg)
string(REGEX REPLACE ".*/([^/]*)" "\\1" simple ${arg})
string(REPLACE ${PROJECT_SOURCE_DIR} "" rel ${arg})
string(REGEX REPLACE "(.*)/[^/]*" "\\1" relpath ${rel})
string(REGEX REPLACE "/" "_" targname ${rel})
set(targname "headercheck_${targname}")
endmacro(dxt_headercheck_target_name)
macro(get_headercheck_targets)
# this is mostly c&p from dune-common, since we need a way to extract
# all target names to pass to our load balancing script
if(ENABLE_HEADERCHECK)
get_property(headerlist GLOBAL PROPERTY headercheck_list)
foreach(header ${headerlist})
list (FIND dxt_ignore_header "${header}" _index)
if (${_index} GREATER -1)
continue()
endif()
#do some name conversion
set(targname ${header})
dxt_headercheck_target_name(${targname})
list(APPEND dxt_headercheck_targets "${targname}")
endforeach(header ${headerlist})
endif(ENABLE_HEADERCHECK)
endmacro(get_headercheck_targets)
macro(BEGIN_TESTCASES)
# https://cmake.org/cmake/help/v3.0/module/FindGTest.html http://purplekarrot.net/blog/cmake-and-test-suites.html
file( GLOB_RECURSE test_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cc" )
foreach( source ${test_sources} )
set(ranks "1")
if( source MATCHES "mpi" )
list(APPEND ranks ${DUNE_MAX_TEST_CORES})
endif( source MATCHES "mpi" )
get_filename_component(testbase ${source} NAME_WE)
string(REPLACE ".cc" ".mini" minifile ${source})
if( EXISTS ${minifile} )
dune_add_system_test(SOURCE ${source} ${COMMON_HEADER}
INIFILE ${minifile}
BASENAME test_${testbase}
CREATED_TARGETS targetlist_${testbase}
ADDED_TESTS testlist_${testbase}
SCRIPT dune_xt_execute.py
${DEBUG_MACRO_TESTS})
foreach(target ${targetlist_${testbase}})
target_link_libraries( ${target} ${ARGN} ${COMMON_LIBS} ${GRID_LIBS} gtest_dune_xt_common )
list(APPEND dxt_test_binaries ${target} )
set(dxt_test_names_${target} ${testlist_${testbase}_${target}})
endforeach(target)
else( EXISTS ${minifile} )
set(target test_${testbase})
dune_add_test( NAME ${target}
SOURCES ${source} ${COMMON_HEADER}
LINK_LIBRARIES ${ARGN} ${COMMON_LIBS} ${GRID_LIBS} gtest_dune_xt_common
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target}
--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/${target}.xml
TIMEOUT ${DXT_TEST_TIMEOUT}
MPI_RANKS ${ranks})
list(APPEND dxt_test_binaries ${target} )
set(dxt_test_names_${target} ${target})
endif( EXISTS ${minifile} )
endforeach( source )
file( GLOB_RECURSE test_templates "${CMAKE_CURRENT_SOURCE_DIR}/*.tpl" )
foreach( template ${test_templates} )
set(ranks "1")
if( template MATCHES "mpi" )
list(APPEND ranks ${DUNE_MAX_TEST_CORES})
endif( template MATCHES "mpi" )
get_filename_component(testbase ${template} NAME_WE)
string(REPLACE ".tpl" ".py" config_fn "${template}")
string(REPLACE ".tpl" ".tpl.cc" out_fn "${template}")
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" out_fn "${out_fn}")
# get the last completed cache for the codegen execution during configure time
foreach(_mod ${ALL_DEPENDENCIES} )
dune_module_path(MODULE ${_mod} RESULT ${_mod}_binary_dir BUILD_DIR)
if(IS_DIRECTORY ${${_mod}_binary_dir})
set(last_dep_bindir ${${_mod}_binary_dir})
endif()
endforeach(_mod DEPENDENCIES)
dune_xt_execute_process(COMMAND ${CMAKE_BINARY_DIR}/dune-env dxt_code_generation.py
"${config_fn}" "${template}" "${CMAKE_CURRENT_BINARY_DIR}"
"${out_fn}" "${last_dep_bindir}")
file( GLOB generated_sources "${out_fn}.*")
if("" STREQUAL "${generated_sources}")
set(generated_sources ${out_fn})
endif()
add_custom_command(OUTPUT "${generated_sources}"
COMMAND ${CMAKE_BINARY_DIR}/dune-env dxt_code_generation.py
"${config_fn}" "${template}" "${CMAKE_CURRENT_BINARY_DIR}"
"${out_fn}" "${last_dep_bindir}"
DEPENDS "${config_fn}" "${template}"
VERBATIM USES_TERMINAL)
foreach(gen_source ${generated_sources})
string(REPLACE "${out_fn}." "" postfix "${gen_source}")
string(REPLACE "${out_fn}" "" postfix "${postfix}")
string(REPLACE ".cc" "" postfix "${postfix}")
if(NOT "" STREQUAL "${postfix}")
set(postfix "__${postfix}")
endif()
set(target test_${testbase}${postfix})
dune_add_test( NAME ${target}
SOURCES ${gen_source} ${COMMON_HEADER}
LINK_LIBRARIES ${ARGN} ${COMMON_LIBS} ${GRID_LIBS} gtest_dune_xt_common
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target}
--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/${target}.xml
TIMEOUT ${DXT_TEST_TIMEOUT}
MPI_RANKS ${ranks})
list(APPEND dxt_test_binaries ${target} )
set(dxt_test_names_${target} ${target})
endforeach()
endforeach( template ${test_templates} )
add_custom_target(test_templates SOURCES ${test_templates})
endmacro(BEGIN_TESTCASES)
macro(END_TESTCASES)
# this excludes meta-ini variation test cases because
# there binary name != test name
foreach( test ${dxt_test_binaries} )
if (TARGET test)
set_tests_properties(${test} PROPERTIES TIMEOUT ${DXT_TEST_TIMEOUT})
endif(TARGET test)
endforeach( test ${dxt_test_binaries} )
add_custom_target(test_binaries DEPENDS ${dxt_test_binaries})
# add_dependencies(test test_binaries)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${DXT_TEST_TIMEOUT} -j ${DXT_TEST_PROCS}
DEPENDS test_binaries USES_TERMINAL)
add_custom_target(recheck COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${DXT_TEST_TIMEOUT} --rerun-failed -j ${DXT_TEST_PROCS}
DEPENDS test_binaries USES_TERMINAL)
foreach (target ${dxt_test_binaries})
set(all_sorted_testnames "${all_sorted_testnames}/${dxt_test_names_${target}}")
endforeach (target ${dxt_test_binaries})
set(dxt_headercheck_targets "")
get_headercheck_targets(dxt_headercheck_targets)
configure_file(${dune-xt-common-module-path}/dxt_test_binaries.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dxt_test_binaries.cmake)
configure_file(${dune-xt-common-module-path}/dxt_all_sorted_testnames.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dxt_all_sorted_testnames.cmake)
configure_file(${dune-xt-common-module-path}/dxt_headercheck_targets.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dxt_headercheck_targets.cmake)
add_custom_target(rerun_test_distribution ${CMAKE_BINARY_DIR}/dune-env distribute_testing.py
"${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/dxt_test_binaries.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dxt_all_sorted_testnames.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dxt_headercheck_targets.cmake"
"${DXT_BIN_COUNT}"
VERBATIM USES_TERMINAL)
add_custom_target(copy_builders_if_different
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/builder_definitions.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/builder_definitions.cmake")
add_custom_target(refresh_test_timings)
add_dependencies(copy_builders_if_different rerun_test_distribution)
add_dependencies(refresh_test_timings copy_builders_if_different)
endmacro(END_TESTCASES)
macro(dxt_exclude_from_headercheck)
exclude_from_headercheck(${ARGV0})
#make this robust to argument being passed with or without ""
string(REGEX REPLACE "[\ \n]+([^\ ])" ";\\1" list ${ARGV0})
set(list "${list};${ARGV}")
foreach(item ${list})
set(item ${CMAKE_CURRENT_SOURCE_DIR}/${item})
list(APPEND dxt_ignore_header ${item})
endforeach()
endmacro(dxt_exclude_from_headercheck)
macro(dxt_add_python_tests)
add_custom_target(test_python
"${CMAKE_BINARY_DIR}/dune-env" "py.test" "."
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/python"
DEPENDS bindings
VERBATIM USES_TERMINAL)
endmacro(dxt_add_python_tests)
add_subdirectory(dune)
add_subdirectory(scripts)
add_subdirectory(wrapper)
dxt_add_python_tests()
from pkg_resources import resource_filename, resource_stream
import pkgutil
import logging
def load_all_submodule(module):
ignore_playground = True
fails = []
for _, module_name, _ in pkgutil.walk_packages(module.__path__, module.__name__ + '.',
lambda n: fails.append((n, ''))):
if ignore_playground and 'playground' in module_name:
continue
try:
__import__(module_name, level=0)
except (TypeError, ImportError) as t:
fails.append((module_name, t))
if len(fails) > 0:
logging.getLogger(module.__name__).fatal('Failed imports: {}'.format(pprint.pformat(fails)))
raise ImportError(module.__name__)
def runmodule(filename):
import pytest
sys.exit(pytest.main(sys.argv[1:] + [filename]))
[pytest]
pep8maxlinelength = 120
pep8ignore = E221,E226,E241,E242
[aliases]
test = pytest
[pep8]
max-line-length = 120
ignore = E221,E226,E241,E242, W0105, N803, N806
# E221 multiple spaces before operator
# E226 missing whitespace around arithmetic operator [ignored by default]
# E241 multiple spaces after ':' [ignored by default]
# E242 tab after `,' [ignored by default]
# W0105 String statement has no effect (we use triple qoted strings as documentation in some files)
# N803 argument name should be lowercase (we use single capital letters everywhere for vectorarrays)
# N806 same for variables in function
[flake8]
max-line-length = 120
ignore = E221,E226,E241,E242, W0105, N803, N806
# The following exclude avoids wrong warnings for unused imports
exclude = __init__.py
[tool:pytest]
testpaths = test/
python_files = test/*.py
python_class = Test
pep8maxlinelength = 120
pep8ignore = E221,E226,E241,E242
addopts= --cov dune/ -p no:warnings
[metadata]
# this is mandatory to lave license end up in .whl
license_file = LICENSE.txt
......@@ -24,7 +24,7 @@ setup(name='dune.xt.common',
packages = find_packages(),
zip_safe = 0,
package_data = {'': ['*.so']},
install_requires=['binpacking==1.3', 'cython', 'jinja2', 'docopt', 'pylicense3', 'ipython'],
install_requires=['binpacking==1.3', 'cython', 'jinja2', 'docopt', 'pylicense3', 'ipython', 'pytest', 'pytest-cov'],
scripts=['./scripts/generate_compare_functions.py',
'./scripts/distribute_testing.py',
'./scripts/dxt_code_generation.py',
......
import pytest
from dune.xt.common.test import load_all_submodule
def test_load_all():
import dune.xt.common as xtc
load_all_submodule(xtc)
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