mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 21:10:10 +01:00
CI: Add a basic test coverage job
Later we'll add one coverage job per backend, and aggregate all of the results at the end for the coverage report.
This commit is contained in:
parent
b5c6ef2853
commit
744f4d75b3
3 changed files with 56 additions and 0 deletions
|
|
@ -477,3 +477,28 @@ macOS x86 host:
|
|||
- export CAIRO_TEST_IGNORE_quartz_rgb24=$(tr '\n' ',' < .gitlab-ci/ignore-quartz-rgb24.txt)
|
||||
- export CAIRO_TEST_TARGET=quartz
|
||||
- (cd build/test && srcdir=../../test ./cairo-test-suite)
|
||||
|
||||
coverage:
|
||||
stage: 'analysis'
|
||||
extends:
|
||||
- '.fdo.distribution-image@fedora'
|
||||
needs:
|
||||
- job: 'fedora image'
|
||||
artifacts: false
|
||||
script:
|
||||
- source ./.gitlab-ci/env.sh
|
||||
- bash -x ./.gitlab-ci/build-with-coverage.sh
|
||||
- bash -x ./.gitlab-ci/gen-coverage.sh
|
||||
coverage: '/Coverage: \d+\.\d+/'
|
||||
artifacts:
|
||||
name: "cairo-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
||||
expire_in: 2 days
|
||||
when: always
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: public/coverage.xml
|
||||
paths:
|
||||
- "_build/meson-logs"
|
||||
- public
|
||||
|
||||
|
|
|
|||
17
.gitlab-ci/build-with-coverage.sh
Normal file
17
.gitlab-ci/build-with-coverage.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
|
||||
|
||||
export CAIRO_TEST_IGNORE_image_argb32=$(tr '\n' ',' < .gitlab-ci/ignore-image-argb32.txt)
|
||||
export CAIRO_TEST_IGNORE_image_rgb24=$(tr '\n' ',' < .gitlab-ci/ignore-image-rgb24.txt)
|
||||
export CAIRO_TEST_IGNORE_image16_rgb24=$(tr '\n' ',' < .gitlab-ci/ignore-image16-rgb24.txt)
|
||||
export CAIRO_TEST_TARGET=image,image16
|
||||
|
||||
meson setup --buildtype=debug _build .
|
||||
meson compile -C _build
|
||||
|
||||
export srcdir=../../test
|
||||
cd _build/test
|
||||
xvfb-run ./cairo-test-suite
|
||||
14
.gitlab-ci/gen-coverage.sh
Normal file
14
.gitlab-ci/gen-coverage.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
mkdir -p public
|
||||
grcov _build --source-dir ./ --prefix-dir ../ --output-type cobertura --branch --ignore-not-existing -o public/coverage.xml
|
||||
grcov _build --source-dir ./ --prefix-dir ../ --output-type html --branch --ignore-not-existing -o public/coverage
|
||||
|
||||
# Print "Coverage: 42.42" so .gitlab-ci.yml will pick it up with a regex
|
||||
#
|
||||
# We scrape this from the HTML report, not the JSON summary, because coverage.json
|
||||
# uses no decimal places, just something like "42%".
|
||||
|
||||
grep -Eo 'abbr title.* %' public/coverage/index.html | head -n 1 | grep -Eo '[0-9.]+ %' | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 }'
|
||||
Loading…
Add table
Reference in a new issue