diff options
author | Chris Parsons <cparsons@google.com> | 2023-04-20 18:24:52 +0000 |
---|---|---|
committer | Christopher Parsons <cparsons@google.com> | 2023-04-20 18:30:52 +0000 |
commit | 34650543637c25081525c3b729f4e6e5925046d9 (patch) | |
tree | b28157819b4f7a41ee5c12162782b301848e1a63 | |
parent | 85aa6aa91a11bccba5da61f942595dfa9101b650 (diff) | |
download | bazel-34650543637c25081525c3b729f4e6e5925046d9.tar.gz |
improvements to determinism_test
1. Remove -x from the script, which reduces the verbosity of script logs
2. Check the toplevel makefile determinism
3. Check the toplevel ninja file determinism (toggleable by an env var)
4. Allow target product and build variant to be set by env var
Bug: 279031476
Test: Ran script in AOSP with and without the SKIP_NINJA_CHECK env var, and
with and without product env vars.
Change-Id: I0b91b2c45f3cdc5cf6fb62e72b0affc865bfa0ff
-rwxr-xr-x | ci/determinism_test.sh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/ci/determinism_test.sh b/ci/determinism_test.sh index 47baafbf..622bc0e3 100755 --- a/ci/determinism_test.sh +++ b/ci/determinism_test.sh @@ -1,4 +1,4 @@ -#!/bin/bash -eux +#!/bin/bash -eu # Copyright (C) 2023 The Android Open Source Project # @@ -33,6 +33,16 @@ if [[ -z ${DIST_DIR+x} ]]; then DIST_DIR="${OUT_DIR}/dist" fi +if [[ -z ${TARGET_PRODUCT+x} ]]; then + echo "TARGET_PRODUCT not set. Using aosp_arm64" + TARGET_PRODUCT=aosp_arm64 +fi + +if [[ -z ${TARGET_BUILD_VARIANT+x} ]]; then + echo "TARGET_BUILD_VARIANT not set. Using userdebug" + TARGET_BUILD_VARIANT=userdebug +fi + UNAME="$(uname)" case "$UNAME" in Linux) @@ -55,8 +65,8 @@ function clean_build { --mk-metrics \ BAZEL_STARTUP_ARGS="--max_idle_secs=5" \ BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \ - TARGET_PRODUCT=aosp_arm64 \ - TARGET_BUILD_VARIANT=userdebug \ + TARGET_PRODUCT=${TARGET_PRODUCT} \ + TARGET_BUILD_VARIANT=${TARGET_BUILD_VARIANT} \ nothing \ dist DIST_DIR=$DIST_DIR } @@ -65,6 +75,10 @@ function save_hash { local -r filepath="$1" find $OUT_DIR/soong/workspace -type f,l -iname "BUILD.bazel" -o -iname "*.bzl" | xargs "${PREBUILTS}"/md5sum > $filepath find $OUT_DIR/soong/soong_injection -type f,l | xargs "${PREBUILTS}"/md5sum >> $filepath + "${PREBUILTS}"/md5sum $OUT_DIR/soong/Android-${TARGET_PRODUCT}.mk >> $filepath + if [[ -z ${SKIP_NINJA_CHECK+x} ]]; then + "${PREBUILTS}"/md5sum $OUT_DIR/soong/build.ninja >> $filepath + fi } TESTDIR=$(mktemp -t testdir.XXXXXX -d) |