From 34650543637c25081525c3b729f4e6e5925046d9 Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Thu, 20 Apr 2023 18:24:52 +0000 Subject: 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 --- ci/determinism_test.sh | 20 +++++++++++++++++--- 1 file 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) -- cgit v1.2.3