This commit is contained in:
Bastian Gruber 2024-11-06 07:29:23 -04:00
Родитель 8e52c088f8
Коммит 48a71c2ebe
6 изменённых файлов: 0 добавлений и 138 удалений

Просмотреть файл

@ -47,15 +47,6 @@ commands:
- run: |
sccache --version
sccache --zero-stats
install-grcov:
steps:
- run:
name: Install grcov
command: |
cargo install --locked grcov@0.8.19
# Run in a different shell to source $BASH_ENV
- run: |
grcov --version
install-mdbook:
steps:
- run:
@ -234,22 +225,6 @@ jobs:
- test-setup
- run: ./automation/tests.py rust-clippy
- save-sccache-cache
Generate code coverage:
executor: docker
resource_class: large
steps:
- full-checkout
- test-setup
- install-grcov
# Test coverage support in Rust has been evolving rapidly, use nightly
# in the hope of getting the best support/features on that front.
- run: RUSTUP_TOOLCHAIN="nightly" bash ./automation/emit_coverage_info.sh
- run:
name: Compile coverage
command: grcov ./target/debug/ -s . -t lcov --llvm --ignore-not-existing --ignore "target/*" --ignore "/*" -o lcov.info
- run:
name: Upload to codecov.io
command: ./automation/upload-to-codecov.sh
Check Protobuf files are up-to-date:
executor: docker
resource_class: small
@ -345,9 +320,6 @@ workflows:
run-tests-min-supported-version:
jobs:
- Rust tests - min supported rust version
coverage:
jobs:
- Generate code coverage
ios-test:
jobs:
- iOS test

Просмотреть файл

@ -1,5 +1,3 @@
<a href="https://codecov.io/gh/mozilla/application-services"> <img src="https://codecov.io/gh/mozilla/application-services/branch/main/graph/badge.svg?token=HxeUysUWqx"/> </a>
# Firefox Application Services
Application Services (a-s) is a collection of Rust Components that are used to enable Firefox applications to integrate with Firefox accounts, sync, experimentation, etc. Each component is built using a core of shared code written in Rust, wrapped with native language bindings for different platforms.

Просмотреть файл

@ -1,57 +0,0 @@
#!/usr/bin/env bash
# Run tests in order to produce coverage data. Does not collect coverage data,
# just produces it. Note that we ignore all test failures -- some of the
# experimental flags we use cause test failures, we don't really care, other CI
# tasks check this anyway.
#
# Note that running this outside of CI doesn't work on all platforms. In
# particular, macos needs further patches in order to work, probably windows
# too. It's really intended for use inside CI only.
#
# Finally, this must be done on nightly -- `cargo-tarpaulin`, which works on
# stable, also has issues with NSS, but not ones that seem easy to work around.
# As a result, we use `grcov`. Ultimately `grcov` should long-term allow us to
# integrate coverage data from over the FFI, which is a huge plus to this
# approach, so it's probably for the best, even if `grcov`'s actual coverage
# information seems to be of lower quality than `tarpaulin`.
if [[ ! -f "$PWD/automation/emit_coverage_info.sh" ]]
then
echo "emit_coverage_info.sh must be executed from the root directory."
exit 1
fi
cargo +nightly clean
# Note that incremental builds, as well as sccache seems to break coverage :(.
# So, we disable those.
export CARGO_INCREMENTAL=0
unset RUSTC_WRAPPER
# TODO: re-add `-Clink-dead-code` to RUSTFLAGS -- right now it causes a build
# linker error in NSS, as apparently some part of NSS we don't use doesn't have
# the build flags set up correctly. This makes our code coverage accuracy worse,
# but AFAICT, not in a massive way -- or at least codecov.io seems to account
# for it in some manner.
#
# Also, this `--cfg coverage` is how the `#[cfg(coverage)]` we use in some parts
# of the rust code comes into existence (it's non-standard)
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort --cfg coverage";
export RUSTDOCFLAGS="-Cpanic=abort"
# Apparently --no-default-features doesn't work in the root, even with -p to select a specific package.
# Instead we pull the list of individual package manifest files which have default features
# out of `cargo metadata` and test using --manifest-path for each individual package.
for manifest in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select((.features | .default | length) > 0 or .name == "nimbus-fml") | .manifest_path'); do
package=$(dirname "$manifest")
package=$(basename "$package")
echo "## no-default-features test for package $package (manifest @ $manifest)"
cargo +nightly test --manifest-path "$manifest" --no-default-features --no-fail-fast || true
done
cargo +nightly test --all --no-fail-fast || true
cargo +nightly run -p sync-test || true
cargo +nightly run -p protobuf-gen -- tools/protobuf_files.toml || true
cargo +nightly run -p systest || true
env RUSTFLAGS="--cfg __appsvc_ci_hack $RUSTFLAGS" cargo +nightly test --all --all-features --no-fail-fast || true

Просмотреть файл

@ -1,36 +0,0 @@
#!/bin/sh
set -ex
# Make the reports file, which combines all reports together (currently we just have 1)
touch reports
cat lcov.info >> reports
echo '<<<<<< EOF' >> reports
# Calculate query params (most of this was taken from the bash uploader script)
# https://circleci.com/docs/environment-variables
service="circleci"
branch="$CIRCLE_BRANCH"
build="$CIRCLE_BUILD_NUM"
job="$CIRCLE_NODE_INDEX"
if [ "$CIRCLE_PROJECT_REPONAME" != "" ];
then
slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
else
# git@github.com:owner/repo.git
slug="${CIRCLE_REPOSITORY_URL##*:}"
# owner/repo.git
slug="${slug%%.git}"
fi
pr="${CIRCLE_PULL_REQUEST##*/}"
commit="$CIRCLE_SHA1"
query="commit=${commit}&branch=${branch}&build=${build}&job=${job}&slug=${slug}&service=${service}&pr=${pr}"
url="https://codecov.io/upload/v2?${query}"
echo "Codecov URL: ${url}"
curl -X POST --data-binary @reports "${url}"

Просмотреть файл

@ -1,11 +0,0 @@
coverage:
# Tell codecov our default branch.
branch: main
# Don't trigger CI failure on coverage reduction.
status:
project:
default:
informational: true
patch:
default:
informational: true

Просмотреть файл

@ -106,10 +106,6 @@ a manual process involving:
Ideally some or all of this would be automated and run in CI, but we have not yet invested in such automation.
## Test Coverage
We currently have code coverage reporting on Github using [codecov](https://github.com/mozilla/application-services/blob/main/codecov.yml). However, our code coverage does not tell us how much more coverage is caused by our consumers' tests.
## Ideas for Improvement
* ASan, Memsan, and maybe other sanitizer checks, especially around the points where we cross FFI boundaries.