From e432297c3e43a476a6d97b6f1bf39bb2859816ce Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Sat, 27 Jan 2018 21:53:44 +0100 Subject: Fix coverage generation * Generate base coverage tracking all files * Reset coverage tracking before running experiments * Use base path KLEE_SRC * Fix uploading of results --- .codecov.yml | 22 ++++++++++++++++++++++ .travis/klee.sh | 31 ++++++++++++++++++++++++------- codecov.yml | 16 ---------------- 3 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 .codecov.yml delete mode 100644 codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000..c4a12ef7 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,22 @@ +codecov: + disable_default_path_fixes: true + +coverage: + status: + project: no + patch: yes + changes: no + precision: 2 + round: down + range: "70...100" + +fixes: + - "home/travis/build/klee/klee::" +ignore: + - "usr/" + - "test/" + - "unittests" + - "**/test-utils" +comment: + layout: "header, diff, changes, uncovered, tree" + behavior: default diff --git a/.travis/klee.sh b/.travis/klee.sh index 88dbdf08..5c5a15b5 100755 --- a/.travis/klee.sh +++ b/.travis/klee.sh @@ -3,20 +3,30 @@ set -e : ${SOLVERS?"Solvers must be specified"} +coverage_setup() +{ + # Zero coverage for any file, e.g. previous tests + lcov --directory . --no-external --zerocounters + # Create a baseline by capturing any file used for compilation, no execution yet + lcov --rc lcov_branch_coverage=1 --directory . --base-directory=${KLEE_SRC} --no-external --capture --initial --output-file coverage_base.info + lcov --rc lcov_branch_coverage=1 --remove coverage_base.info 'test/*' --output-file coverage_base.info + lcov --rc lcov_branch_coverage=1 --remove coverage_base.info 'unittests/*' --output-file coverage_base.info +} + coverageup() { # Create report # (NOTE: "--rc lcov_branch_coverage=1" needs to be added in all calls, otherwise branch coverage gets dropped) - lcov --rc lcov_branch_coverage=1 --directory . --capture --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --directory . --base-directory=${KLEE_SRC} --no-external --capture --output-file coverage.info # Exclude uninteresting coverage goals (LLVM, googletest, and KLEE system and unit tests) - lcov --rc lcov_branch_coverage=1 --remove coverage.info '/usr/*' --output-file coverage.info - lcov --rc lcov_branch_coverage=1 --remove coverage.info 'test-utils/*' --output-file coverage.info - lcov --rc lcov_branch_coverage=1 --remove coverage.info 'klee/test/*' --output-file coverage.info - lcov --rc lcov_branch_coverage=1 --remove coverage.info 'klee/unittests/*' --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --remove coverage.info 'test/*' --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --remove coverage.info 'unittests/*' --output-file coverage.info + # Combine baseline and measured coverage + lcov --rc lcov_branch_coverage=1 -a coverage_base.info -a coverage.info -o coverage_all.info # Debug info - lcov --rc lcov_branch_coverage=1 --list coverage.info + lcov --rc lcov_branch_coverage=1 --list coverage_all.info # Uploading report to CodeCov - bash <(curl -s https://codecov.io/bash) -X gcov -y ${KLEE_SRC}/codecov.yml -f coverage.info -F $1 + bash <(curl -s https://codecov.io/bash) -R ${KLEE_SRC} -X gcov -y ${KLEE_SRC}/.codecov.yml -f coverage_all.info -F $1 } ############################################################################### @@ -153,6 +163,10 @@ make ############################################################################### # Unit tests ############################################################################### +# Prepare coverage information if COVERAGE is set +if [ ${COVERAGE} -eq 1 ]; then + coverage_setup +fi make unittests # Generate and upload coverage if COVERAGE is set @@ -163,6 +177,9 @@ fi ############################################################################### # lit tests ############################################################################### +if [ ${COVERAGE} -eq 1 ]; then + coverage_setup +fi make systemtests # If metaSMT is the only solver, then rerun lit tests with non-default metaSMT backends diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 4fd8129f..00000000 --- a/codecov.yml +++ /dev/null @@ -1,16 +0,0 @@ -codecov: - disable_default_path_fixes: true - -coverage: - status: - project: no - patch: yes - changes: no - -fixes: - - "home/travis/build/klee/klee::" -ignore: - - "usr/" - - "test/" - - "unittests" - - "**/test-utils" -- cgit 1.4.1