CI: add test coverage results
This runs the coverage tools to produce HTML pages listing the code lines / functions / branches hit/totalled by the test suite. Nowadays Gitlab has some Cobertura support itself: https://docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html lcov is needed for the HTML report, gcovr is needed for the Cobertura report. 'ninja clean' must be removed, otherwise it deletes the coverage files before they are analysed. Seeing the test suite code coverage is really interesting. It can guide designing tests. If Gitlab MRs show the coverage in diff view, it shows if new code actually gets executed in CI. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
022ea43f9b
commit
e72119f1ee
@ -20,7 +20,7 @@ stages:
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: buster
|
||||
FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh'
|
||||
FDO_DISTRIBUTION_TAG: '2021-02-25.1'
|
||||
FDO_DISTRIBUTION_TAG: '2021-03-04.1'
|
||||
|
||||
|
||||
container_prep:
|
||||
@ -67,7 +67,6 @@ container_prep:
|
||||
- virtme-run --rw --pwd --kimg /weston-virtme/bzImage --script-dir ../.gitlab-ci/virtme-scripts
|
||||
- TEST_RES=$(cat $TESTS_RES_PATH)
|
||||
- rm $TESTS_RES_PATH
|
||||
- ninja clean
|
||||
- cp -R /weston-virtme ./
|
||||
- rm weston-virtme/bzImage
|
||||
- exit $TEST_RES
|
||||
@ -103,8 +102,16 @@ container_prep:
|
||||
build-native-meson-default-options:
|
||||
variables:
|
||||
MESON_OPTIONS: >
|
||||
-Doptimization=0
|
||||
-Db_coverage=true
|
||||
-Dwerror=true
|
||||
extends: .build-native-meson
|
||||
after_script:
|
||||
- ninja -C build-* coverage-html
|
||||
- ninja -C build-* coverage-xml
|
||||
artifacts:
|
||||
reports:
|
||||
cobertura: build-*/meson-logs/coverage.xml
|
||||
|
||||
build-docs:
|
||||
variables:
|
||||
@ -123,17 +130,20 @@ build-native-meson-no-gl-renderer:
|
||||
-Dwerror=true
|
||||
extends: .build-native-meson
|
||||
|
||||
preview-docs:
|
||||
docs-and-coverage:
|
||||
stage: pages
|
||||
script:
|
||||
- mv prefix-weston-build-docs/share/doc/weston Documentation
|
||||
- mv build-weston-build-native-meson-default-options/meson-logs/coveragereport Test_Coverage
|
||||
- rm -rf build-* prefix-*
|
||||
dependencies:
|
||||
- build-docs
|
||||
- build-native-meson-default-options
|
||||
artifacts:
|
||||
expose_as: 'Documentation preview'
|
||||
expose_as: 'Documentation preview and test coverage report'
|
||||
paths:
|
||||
- Documentation/
|
||||
- Test_Coverage/
|
||||
|
||||
pages:
|
||||
stage: pages
|
||||
|
@ -36,7 +36,9 @@ apt-get -y --no-install-recommends install \
|
||||
build-essential \
|
||||
curl \
|
||||
doxygen \
|
||||
gcovr \
|
||||
git \
|
||||
lcov \
|
||||
libasound2-dev \
|
||||
libbluetooth-dev \
|
||||
libcairo2-dev \
|
||||
|
Loading…
Reference in New Issue
Block a user