Skip to content

Commit ccf6d23

Browse files
committed
[ci,cov] Clean up output directories before collecting coverage data
This ensures that the output directories are empty before we start collecting data, avoiding potential issues with stale data from previous runs. Change-Id: I8eaba03e802c1703183fc8c93e0f7c1d5e6463f4 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
1 parent 57716b9 commit ccf6d23

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ci/scripts/collect-coverage-report.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ cp -r bazel-out/_coverage/* "${OUTPUT_DIR}" || true
2626
find "${OUTPUT_DIR}" -type f -exec chmod 644 {} +
2727

2828
echo "Collect all test coverage data"
29+
rm -rf "${TESTS:?}"
2930
mkdir -p "${TESTS}"
3031
rsync -a --ignore-missing-args --files-from="${LCOV_FILES}" . "${TESTS}/"
3132

3233
echo "Merge all coverage data"
3334
find "${TESTS}" -type f -name "*.dat" -exec cat {} + > "${COVERAGE}"
3435

3536
echo "Collect all test logs"
37+
rm -rf "${LOGS:?}"
3638
mkdir -p "${LOGS}"
3739
cat "${LCOV_FILES}" | while read -r lcov; do
3840
test_dir=$(dirname "${lcov}")
@@ -44,6 +46,7 @@ cat "${LCOV_FILES}" | while read -r lcov; do
4446
done
4547

4648
echo "Collect all source files listed in coverage data"
49+
rm -rf "${SOURCES:?}"
4750
mkdir -p "${SOURCES}"
4851
grep -h '^SF:' "${COVERAGE}" | sed 's/^SF://' | sort -u > "${SOURCE_LIST}"
4952
python3 util/fetch-remote-cache.py --file-list="${SOURCE_LIST}"

0 commit comments

Comments
 (0)