diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-09-26 12:18:24 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-09-26 12:18:24 -0500 |
commit | adc2d2e0e21258bad797b4400fb2382988886989 (patch) | |
tree | a86ec955be0c584a2444d67b9ea8748956385055 | |
parent | a18b13a10138f40093906735cf4ccceb965d2589 (diff) | |
download | librsvg-adc2d2e0e21258bad797b4400fb2382988886989.tar.gz |
CI: Move the coverage script to an actual shell script
I sometimes run this at home, and cutting&pasting things from
.gitlab-ci.yml gets old pretty fast. So let's make this reusable.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/754>
-rw-r--r-- | .gitlab-ci.yml | 20 | ||||
-rw-r--r-- | ci/build-with-coverage.sh | 22 |
2 files changed, 24 insertions, 18 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e43eaf5f..8f031893 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -302,25 +302,9 @@ coverage: - job: opensuse-container@x86_64.stable - job: check artifacts: false - variables: - # Mixed gcc and Rust/LLVM coverage for the C API tests: - # https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64/code-coverage#15 - CC: "clang" - CFLAGS: "-coverage -ftest-coverage -fprofile-arcs" - # RUSTFLAGS: "-Cinstrument-coverage" - RUSTDOCFLAGS: "-Cinstrument-coverage" - LLVM_PROFILE_FILE: "coverage-profiles/coverage-%p-%m.profraw" - LDFLAGS: "--coverage -L/usr/lib64/clang/14.0.6/lib/linux" - LIBS: "-lclang_rt.profile-x86_64" - RUSTC_BOOTSTRAP: "1" # hack to make -Zprofile work on the non-nightly compiler - CARGO_INCREMENTAL: "0" # -Zprofile (gcov) doesn't like incremental compilation - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off" script: - - mkdir -p _build - - cd _build - - ../autogen.sh --disable-gtk-doc --disable-vala --enable-debug - - make - - make -k check + - source ./ci/env.sh + - bash -x ./ci/build-with-coverage.sh after_script: - source ./ci/env.sh - bash -x ./ci/gen-coverage.sh diff --git a/ci/build-with-coverage.sh b/ci/build-with-coverage.sh new file mode 100644 index 00000000..9d4dea73 --- /dev/null +++ b/ci/build-with-coverage.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -eux -o pipefail + +# Mixed gcc and Rust/LLVM coverage for the C API tests: +# https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64/code-coverage#15 +export CC="clang" +export CFLAGS="-coverage -ftest-coverage -fprofile-arcs" +# RUSTFLAGS: "-Cinstrument-coverage" +export RUSTDOCFLAGS="-Cinstrument-coverage" +export LLVM_PROFILE_FILE="coverage-profiles/coverage-%p-%m.profraw" +export LDFLAGS="--coverage -L/usr/lib64/clang/14.0.6/lib/linux" +export LIBS="-lclang_rt.profile-x86_64" +export RUSTC_BOOTSTRAP="1" # hack to make -Zprofile work on the non-nightly compiler +export CARGO_INCREMENTAL="0" # -Zprofile (gcov) doesn't like incremental compilation +export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off" + +mkdir -p _build +cd _build +../autogen.sh --disable-gtk-doc --disable-vala --enable-debug +make +make -k check |