From cc71b2ac3cc0958aef9ce091c9ddf6e177e969d7 Mon Sep 17 00:00:00 2001 From: yihau Date: Thu, 15 Aug 2024 12:32:08 +0800 Subject: [PATCH] use correct llvm path for coverage test --- ci/docker/Dockerfile | 2 +- scripts/coverage.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile index fa801cf124314f..622b017146f817 100644 --- a/ci/docker/Dockerfile +++ b/ci/docker/Dockerfile @@ -70,11 +70,11 @@ RUN \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --no-modify-path --profile minimal --default-toolchain $RUST_VERSION -y && \ rustup component add rustfmt && \ rustup component add clippy && \ - rustup component add llvm-tools-preview && \ rustup install $RUST_NIGHTLY_VERSION && \ rustup component add clippy --toolchain=$RUST_NIGHTLY_VERSION && \ rustup component add rustfmt --toolchain=$RUST_NIGHTLY_VERSION && \ rustup component add miri --toolchain=$RUST_NIGHTLY_VERSION && \ + rustup component add llvm-tools-preview --toolchain=$RUST_NIGHTLY_VERSION && \ rustup target add wasm32-unknown-unknown && \ cargo install cargo-audit && \ cargo install cargo-hack && \ diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 9fc43be5eba03b..6a144316ba50c1 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -28,6 +28,14 @@ fi # shellcheck source=ci/rust-version.sh source "$here/../ci/rust-version.sh" nightly +# Check llvm path +llvm_profdata="$(find "$(rustc +"$rust_nightly" --print sysroot)" -name llvm-profdata)" +if [ -z "$llvm_profdata" ]; then + echo "Error: couldn't find llvm-profdata. Try installing the llvm-tools component with \`rustup component add llvm-tools-preview --toolchain=$rust_nightly\`" + exit 1 +fi +llvm_path="$(dirname "$llvm_profdata")" + # get commit hash. it will be used to name output folder if [ -z "$COMMIT_HASH" ]; then COMMIT_HASH=$(git rev-parse --short=9 HEAD) @@ -66,6 +74,7 @@ grcov_common_args=( --source-dir "$here/.." --binary-path "$here/../target/cov/debug" --llvm + --llvm-path "$llvm_path" --ignore \*.cargo\* --ignore \*build.rs --ignore bench-tps\*