diff options
author | Patrick Griffis <pgriffis@igalia.com> | 2020-11-13 15:38:49 -0600 |
---|---|---|
committer | Patrick Griffis <pgriffis@igalia.com> | 2020-11-13 15:45:59 -0600 |
commit | a7aa133dbafd8a71fbe55591165505504ec14ea1 (patch) | |
tree | 2a5977743d0dc621f33fe5c90ce346b2ca344804 | |
parent | 36108549d0ed646d6ce55d21489409752fd68f81 (diff) | |
download | libsoup-pgriffis/valgrind.tar.gz |
ci: Simplify coverage reportspgriffis/valgrind
-rw-r--r-- | .gitlab-ci.yml | 27 | ||||
-rw-r--r-- | .gitlab-ci/coverage-docker.sh | 33 | ||||
-rw-r--r-- | .gitlab-ci/fixup-cov-paths.py | 29 | ||||
-rw-r--r-- | .gitlab-ci/lcovrc | 13 |
4 files changed, 5 insertions, 97 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72eb5d6a..8becaa0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,15 +15,11 @@ stages: fedora-test: extends: .build - variables: - CFLAGS: "-coverage -ftest-coverage -fprofile-arcs" script: - - meson _build -Dauto_features=enabled + - meson _build -Db_coverage=true -Dauto_features=enabled - ninja -C _build - - mkdir -p _coverage - - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov" - ninja -C _build test - - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov" + - ninja -C _build coverage-html artifacts: reports: junit: "_build/${CI_JOB_NAME}-report.xml" @@ -31,9 +27,9 @@ fedora-test: when: always paths: - "_build/config.h" - - "_build/meson-logs" - - "_build/${CI_JOB_NAME}-report.xml" - - "_coverage" + - "_build/meson-logs/testlog.txt" + - "_build/meson-logs/coveragereport" + coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/' fedora-scan: extends: .build @@ -58,19 +54,6 @@ fedora-valgrind: paths: - _build/meson-logs/testlog-valgrind.txt -coverage: - stage: coverage - needs: [fedora-test] - except: - - tags - artifacts: - name: "libsoup-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" - paths: - - _coverage/ - script: - - bash -x ./.gitlab-ci/coverage-docker.sh - coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/' - reference: stage: docs variables: diff --git a/.gitlab-ci/coverage-docker.sh b/.gitlab-ci/coverage-docker.sh deleted file mode 100644 index 9e9487d7..00000000 --- a/.gitlab-ci/coverage-docker.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -e - -# Fixup Windows paths -lcov_paths=$(find _coverage -name "*.lcov" -print) -python3 ./.gitlab-ci/fixup-cov-paths.py ${lcov_paths} - -for path in _coverage/*.lcov; do - # Remove coverage from generated code in the build directory - lcov --config-file .gitlab-ci/lcovrc -r "${path}" '*/_build/*' -o "$(pwd)/${path}" - # Remove any coverage from system files - lcov --config-file .gitlab-ci/lcovrc -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}" -done - -genhtml \ - --ignore-errors=source \ - --config-file .gitlab-ci/lcovrc \ - _coverage/*.lcov \ - -o _coverage/coverage - -cd _coverage -rm -f *.lcov - -cat >index.html <<EOL -<html> -<body> -<ul> -<li><a href="coverage/index.html">Coverage</a></li> -</ul> -</body> -</html> -EOL diff --git a/.gitlab-ci/fixup-cov-paths.py b/.gitlab-ci/fixup-cov-paths.py deleted file mode 100644 index 83190058..00000000 --- a/.gitlab-ci/fixup-cov-paths.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import os -import io - - -def main(argv): - # Fix paths in lcov files generated on a Windows host so they match our - # current source layout. - paths = argv[1:] - - for path in paths: - print("cov-fixup:", path) - text = io.open(path, "r", encoding="utf-8").read() - text = text.replace("\\\\", "/") - libsoup_dir = "/libsoup/" - end = text.index(libsoup_dir) - start = text[:end].rindex(":") + 1 - old_root = text[start:end] - assert os.path.basename(os.getcwd()) == "libsoup" - new_root = os.path.dirname(os.getcwd()) - if old_root != new_root: - print("replacing %r with %r" % (old_root, new_root)) - text = text.replace(old_root, new_root) - with io.open(path, "w", encoding="utf-8") as h: - h.write(text) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/.gitlab-ci/lcovrc b/.gitlab-ci/lcovrc deleted file mode 100644 index ac5997b7..00000000 --- a/.gitlab-ci/lcovrc +++ /dev/null @@ -1,13 +0,0 @@ -# lcov and genhtml configuration -# See http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php - -# Always enable branch coverage -lcov_branch_coverage = 1 - -# Exclude precondition assertions, as we can never reasonably get full branch -# coverage of them, as they should never normally fail. -# See https://github.com/linux-test-project/lcov/issues/44 -lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_ - -# Similarly for unreachable assertions. -lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached |