Skip to content

Commit

Permalink
maintainer: coverage for integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSzuttor committed Jul 22, 2020
1 parent 95a9464 commit 663ca88
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ coverage:
status:
project:
default: false
integration_tests:
paths:
- testsuite/python/
enabled: yes
threshold: 1%
tests:
paths:
- src/core/unit_tests/
Expand Down
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
parallel = True
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:700579881dceba20fa27ec476a4b4e0746b72683
image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:8a7d258889d87dcc9c96a200784b30b532d45b33

stages:
- prepare
Expand Down Expand Up @@ -221,7 +221,7 @@ cuda10-maxset:
cuda9-maxset:
<<: *global_job_definition
stage: build
image: docker.pkg.github.com/espressomd/docker/ubuntu-18.04:d496478230db4e5c286680e3bdc1621af1fccffc
image: docker.pkg.github.com/espressomd/docker/ubuntu-18.04:8a7d258889d87dcc9c96a200784b30b532d45b33
variables:
CC: 'gcc-6'
CXX: 'g++-6'
Expand Down
5 changes: 3 additions & 2 deletions maintainer/CI/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,12 @@ if [ "${with_coverage}" = true ]; then
lcov --gcov-tool "${GCOV:-gcov}" -q --directory . --ignore-errors graph --capture --output-file coverage.info # capture coverage info
lcov --gcov-tool "${GCOV:-gcov}" -q --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
lcov --gcov-tool "${GCOV:-gcov}" -q --remove coverage.info '*/doc/*' --output-file coverage.info # filter out docs
python3 -m coverage combine testsuite/python
# Uploading report to Codecov
if [ -z "${CODECOV_TOKEN}" ]; then
bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports"
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
else
bash <(curl -s https://codecov.io/bash) -t "${CODECOV_TOKEN}" -X gcov || echo "Codecov did not collect coverage reports"
bash <(curl -s https://codecov.io/bash) -t "${CODECOV_TOKEN}" || echo "Codecov did not collect coverage reports"
fi
fi

Expand Down
4 changes: 4 additions & 0 deletions src/python/pypresso.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ case "$1" in
shift
exec lldb -- "@PYTHON_FRONTEND@" "$@"
;;
--coverage)
shift
exec @PYTHON_EXECUTABLE@ -m coverage run --source=@CMAKE_BINARY_DIR@/testsuite/python --rcfile="@PROJECT_SOURCE_DIR@/.coveragerc" "$@"
;;
--valgrind)
shift
exec valgrind --leak-check=full "@PYTHON_FRONTEND@" "$@"
Expand Down
9 changes: 7 additions & 2 deletions testsuite/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ function(PYTHON_TEST)
set(TEST_NUM_PROC ${TEST_MAX_NUM_PROC})
endif()

if(WITH_COVERAGE)
set(PYPRESSO_OPTIONS --coverage)
endif(WITH_COVERAGE)

if(EXISTS ${MPIEXEC})
add_test(
NAME ${TEST_NAME}
COMMAND
${MPIEXEC} ${MPIEXEC_OVERSUBSCRIBE} ${MPIEXEC_NUMPROC_FLAG}
${TEST_NUM_PROC} ${MPIEXEC_PREFLAGS} ${CMAKE_BINARY_DIR}/pypresso
${TEST_FILE} ${MPIEXEC_POSTFLAGS})
${PYPRESSO_OPTIONS} ${TEST_FILE} ${MPIEXEC_POSTFLAGS})
else()
add_test(${TEST_NAME} ${CMAKE_BINARY_DIR}/pypresso ${TEST_FILE})
add_test(${TEST_NAME} ${CMAKE_BINARY_DIR}/pypresso ${PYPRESSO_OPTIONS}
${TEST_FILE})
endif()
set_tests_properties(${TEST_NAME} PROPERTIES PROCESSORS ${TEST_NUM_PROC}
DEPENDS "${TEST_DEPENDS}")
Expand Down

0 comments on commit 663ca88

Please sign in to comment.