Add integration test for ensuring that stale metrics files are deleted.
Bug: 286083726 Test: run the script Change-Id: I2dd382b3a0ee1b226f4931fed3bc4b5df0a3528c
This commit is contained in:
parent
03520eb2f9
commit
5040c36649
2 changed files with 48 additions and 0 deletions
|
@ -9,6 +9,7 @@ TOP="$(readlink -f "$(dirname "$0")"/../../..)"
|
|||
"$TOP/build/soong/tests/bp2build_bazel_test.sh"
|
||||
"$TOP/build/soong/tests/persistent_bazel_test.sh"
|
||||
"$TOP/build/soong/tests/soong_test.sh"
|
||||
"$TOP/build/soong/tests/stale_metrics_files_test.sh"
|
||||
"$TOP/build/bazel/ci/rbc_regression_test.sh" aosp_arm64-userdebug
|
||||
|
||||
# The following tests build against the full source tree and don't rely on the
|
||||
|
|
47
tests/stale_metrics_files_test.sh
Executable file
47
tests/stale_metrics_files_test.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# This test ensures that stale metrics files are deleted after each run
|
||||
|
||||
# Run bazel
|
||||
# Note - bp2build metrics are present after clean runs, only
|
||||
build/soong/soong_ui.bash --make-mode clean
|
||||
build/bazel/bin/b build libcore:all
|
||||
soong_build_metrics_files=("out/soong_build_metrics.pb" "out/build_progress.pb" "out/soong_metrics" "out/bp2build_metrics.pb")
|
||||
bazel_build_metrics_files=("out/bazel_metrics.pb" "out/build_progress.pb" "out/soong_metrics" "out/bp2build_metrics.pb")
|
||||
|
||||
# Ensure bazel metrics files are present
|
||||
for i in ${!bazel_build_metrics_files[@]};
|
||||
do
|
||||
file=${bazel_build_metrics_files[$i]}
|
||||
if [[ ! -f $file ]]; then
|
||||
echo "Missing metrics file for Bazel build " $file
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Run a soong build
|
||||
build/soong/soong_ui.bash --make-mode nothing
|
||||
|
||||
for i in ${!soong_build_metrics_files[@]};
|
||||
do
|
||||
file=${soong_build_metrics_files[$i]}
|
||||
if [[ ! -f $file ]]; then
|
||||
echo "Missing metrics file for Soong build " $file
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Ensure that bazel_metrics.pb is deleted
|
||||
if [[ -f out/bazel_metrics.pb ]]; then
|
||||
echo "Stale out/bazel_metrics.pb file detected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run bazel again - to make sure that soong_build_metrics.pb gets deleted
|
||||
build/bazel/bin/b build libcore:all
|
||||
|
||||
if [[ -f out/soong_build_metrics.pb ]]; then
|
||||
echo "Stale out/soong_build_metrics.pb file detected"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in a new issue