20260147 迭代优化全量测试和覆盖率测试,时间从325秒降低到90+秒,覆盖率维持在90%
This commit is contained in:
@@ -5,6 +5,19 @@ set -euo pipefail
|
||||
# rustup component add llvm-tools-preview
|
||||
# cargo install cargo-llvm-cov --locked
|
||||
|
||||
# Optional:
|
||||
# COVERAGE_FORCE_CLEAN=1 Force `cargo llvm-cov clean --workspace` before the run.
|
||||
# Default behavior is to reuse existing llvm-cov build artifacts.
|
||||
# RPKI_SKIP_HEAVY_SCRIPT_REPLAY_TESTS=1 Skip replay/matrix integration tests that
|
||||
# spawn shell pipelines and can trigger separate release builds.
|
||||
# coverage.sh enables this by default.
|
||||
# RPKI_SKIP_HEAVY_BLACKBOX_TESTS=1 Skip slower blackbox CLI/script integration tests
|
||||
# that provide low incremental coverage per wall-clock second.
|
||||
# coverage.sh enables this by default.
|
||||
# RPKI_SKIP_HEAVY_CRYPTO_TESTS=1 Skip slower OpenSSL-heavy certificate generation tests
|
||||
# that provide low incremental coverage per wall-clock second.
|
||||
# coverage.sh enables this by default.
|
||||
|
||||
run_out="$(mktemp)"
|
||||
text_out="$(mktemp)"
|
||||
html_out="$(mktemp)"
|
||||
@@ -20,7 +33,16 @@ IGNORE_REGEX='src/bin/replay_bundle_capture\.rs|src/bin/replay_bundle_capture_de
|
||||
# We run tests only once, then generate both CLI text + HTML reports without rerunning tests.
|
||||
set +e
|
||||
|
||||
cargo llvm-cov clean --workspace >/dev/null 2>&1
|
||||
if [ "${COVERAGE_FORCE_CLEAN:-0}" = "1" ]; then
|
||||
cargo llvm-cov clean --workspace >/dev/null 2>&1
|
||||
echo "coverage mode: clean build (COVERAGE_FORCE_CLEAN=1)"
|
||||
else
|
||||
echo "coverage mode: reuse existing llvm-cov artifacts (default)"
|
||||
fi
|
||||
|
||||
export RPKI_SKIP_HEAVY_SCRIPT_REPLAY_TESTS="${RPKI_SKIP_HEAVY_SCRIPT_REPLAY_TESTS:-1}"
|
||||
export RPKI_SKIP_HEAVY_BLACKBOX_TESTS="${RPKI_SKIP_HEAVY_BLACKBOX_TESTS:-1}"
|
||||
export RPKI_SKIP_HEAVY_CRYPTO_TESTS="${RPKI_SKIP_HEAVY_CRYPTO_TESTS:-1}"
|
||||
|
||||
# 1) Run tests once to collect coverage data (no report).
|
||||
script -q -e -c "CARGO_TERM_COLOR=always cargo llvm-cov --no-report" "$run_out" >/dev/null 2>&1
|
||||
|
||||
Reference in New Issue
Block a user