| 1 | #!/bin/bash |
| 2 | |
| 3 | set -eux -o pipefail |
| 4 | |
| 5 | clang_version=$(clang --version | head -n 1 | cut -d' ' -f 3 | cut -d'.' -f 1) |
| 6 | clang_libraries_path="/usr/lib64/clang/$clang_version/lib/linux" |
| 7 | clang_profile_lib="clang_rt.profile-x86_64" |
| 8 | |
| 9 | if [ ! -d "$clang_libraries_path" ] |
| 10 | then |
| 11 | echo "Expected clang libraries (for $clang_profile_lib) to be in $clang_libraries_path" |
| 12 | echo "but that directory does not exist. Please adjust the build-with-coverage.sh script." |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | # Mixed gcc and Rust/LLVM coverage for the C API tests: |
| 17 | # https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64/code-coverage#15 |
| 18 | export CC="clang" |
| 19 | export RUSTDOCFLAGS="-C instrument-coverage" |
| 20 | LLVM_PROFILE_FILE="$(pwd)/coverage-profiles/coverage-%p-%m.profraw" |
| 21 | export LLVM_PROFILE_FILE |
| 22 | export RUSTC_BOOTSTRAP="1" # hack to make unstable options work on the non-nightly compiler |
| 23 | export RUSTFLAGS="-C instrument-coverage -Z coverage-options=condition -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off" |
| 24 | |
| 25 | # meson setup _build -Db_coverage=true -Dauto_features=disabled -Dpixbuf{,-loader}=enabled --buildtype=debugoptimized |
| 26 | # meson compile -C _build |
| 27 | # meson test -C _build --maxfail 0 --print-errorlogs |
| 28 | |
| 29 | cargo test -- --include-ignored |