aboutsummaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2023-04-04 07:34:30 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-04-04 07:34:30 +0000
commit8173feb20ebba6c5193f33dd252a4c9ed9efd42d (patch)
treea7febae69f3f8ec3d3f3901c7e18efeceb2f9102 /ci
parent9b3b841386980390d427e66380040ec4cee72b8d (diff)
parentae663543f1fe296910a8d760e8be37c5080adea9 (diff)
downloadbazel-8173feb20ebba6c5193f33dd252a4c9ed9efd42d.tar.gz
Merge "Test for differing bp2build files in multiproduct_analysis"
Diffstat (limited to 'ci')
-rwxr-xr-xci/multiproduct_analysis.sh31
1 files changed, 26 insertions, 5 deletions
diff --git a/ci/multiproduct_analysis.sh b/ci/multiproduct_analysis.sh
index ceb59713..2105ea55 100755
--- a/ci/multiproduct_analysis.sh
+++ b/ci/multiproduct_analysis.sh
@@ -1,15 +1,18 @@
#!/bin/bash -eux
-AOSP_ROOT="$(dirname $0)/../../.."
-OUT_DIR=$(realpath ${OUT_DIR:-${AOSP_ROOT}/out})
-
source "$(dirname $0)/target_lists.sh"
+cd "$(dirname $0)/../../.."
+OUT_DIR=$(realpath ${OUT_DIR:-out})
+
-read -ra PRODUCTS <<<"$(${AOSP_ROOT}/build/soong/soong_ui.bash --dumpvar-mode all_named_products)"
+read -ra PRODUCTS <<<"$(build/soong/soong_ui.bash --dumpvar-mode all_named_products)"
FAILED_PRODUCTS=()
+PRODUCTS_WITH_BP2BUILD_DIFFS=()
function report {
+ # Turn off -x so that we can see the printfs more clearly
+ set +x
# check if FAILED_PRODUCTS is not empty
if (( ${#FAILED_PRODUCTS[@]} )); then
printf "Failed products:\n"
@@ -19,10 +22,23 @@ function report {
# TODO(b/261023967): Don't fail the build until every product is OK and we want to prevent backsliding.
# exit 1
fi
+ if (( ${#PRODUCTS_WITH_BP2BUILD_DIFFS[@]} )); then
+ printf "Products that produced different bp2build files from aosp_arm64:\n"
+ printf '%s\n' "${PRODUCTS_WITH_BP2BUILD_DIFFS[@]}"
+
+ # TODO(b/261023967): Don't fail the build until every product is OK and we want to prevent backsliding.
+ # exit 1
+ fi
}
trap report EXIT
+# Create zip of the bp2build files for aosp_arm64. We'll check that all other products produce
+# identical bp2build files
+export TARGET_PRODUCT="aosp_arm64"
+build/soong/soong_ui.bash --make-mode --skip-soong-tests bp2build
+tar --mtime='1970-01-01' -czf "out/multiproduct_analysis_reference_bp2build_files.tar.gz" -C out/soong/bp2build .
+
total=${#PRODUCTS[@]}
count=1
@@ -33,11 +49,16 @@ for product in "${PRODUCTS[@]}"; do
export TARGET_PRODUCT="${product}"
# Re-run product config and bp2build for every TARGET_PRODUCT.
- "${AOSP_ROOT}/build/soong/soong_ui.bash" --make-mode --skip-soong-tests bp2build
+ build/soong/soong_ui.bash --make-mode --skip-soong-tests bp2build
# Remove the ninja_build output marker file to communicate to buildbot that this is not a regular Ninja build, and its
# output should not be parsed as such.
rm -f out/ninja_build
+ rm -f out/multiproduct_analysis_current_bp2build_files.tar.gz
+ tar --mtime='1970-01-01' -czf "out/multiproduct_analysis_current_bp2build_files.tar.gz" -C out/soong/bp2build .
+ diff -q out/multiproduct_analysis_current_bp2build_files.tar.gz out/multiproduct_analysis_reference_bp2build_files.tar.gz || \
+ PRODUCTS_WITH_BP2BUILD_DIFFS+=("${product}")
+
STARTUP_FLAGS=(
# Keep the Bazel server alive, package cache hot and reduce excessive I/O
# and wall time by ensuring that max_idle_secs is longer than bp2build which