From 59d5d832be20c37f301ccf4d0de2e0004d49bd86 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 25 Apr 2023 18:38:02 -0600 Subject: ci/build-with-coverage.sh: update for clang 16, same as in the main branch From 43051221275a35c5c4f6d6fcaf4f654a03e1e171 --- .gitlab-ci.yml | 2 -- ci/build-with-coverage.sh | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fcbb5731..0e021c1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -339,8 +339,6 @@ coverage: script: - source ./ci/env.sh - bash -x ./ci/build-with-coverage.sh - after_script: - - source ./ci/env.sh - bash -x ./ci/gen-coverage.sh coverage: '/Coverage: \d+\.\d+/' artifacts: diff --git a/ci/build-with-coverage.sh b/ci/build-with-coverage.sh index 134c9fde..9226a695 100644 --- a/ci/build-with-coverage.sh +++ b/ci/build-with-coverage.sh @@ -2,7 +2,16 @@ set -eux -o pipefail -clang_version=$(clang --version | head -n 1 | cut -d' ' -f 3) +clang_version=$(clang --version | head -n 1 | cut -d' ' -f 3 | cut -d'.' -f 1) +clang_libraries_path="/usr/lib64/clang/$clang_version/lib/linux" +clang_profile_lib="clang_rt.profile-x86_64" + +if [ ! -d $clang_libraries_path ] +then + echo "Expected clang libraries (for $clang_profile_lib) to be in $clang_libraries_path" + echo "but that directory does not exist. Please adjust the build-with-coverage.sh script." + exit 1 +fi # Mixed gcc and Rust/LLVM coverage for the C API tests: # https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64/code-coverage#15 @@ -10,9 +19,9 @@ 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/$clang_version/lib/linux" -export LIBS="-lclang_rt.profile-x86_64" +export LLVM_PROFILE_FILE="$(pwd)/coverage-profiles/coverage-%p-%m.profraw" +export LDFLAGS="--coverage -L$clang_libraries_path" +export LIBS="-l$clang_profile_lib" 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" -- cgit v1.2.1