From da1d416f83942dc1b1b203cdd4d79c47fce7335f Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Wed, 23 Aug 2017 12:19:25 +0200 Subject: Add a Bazel test testing determinism of `bazel build //src:bazel` - Test if hash(bazel1) == hash(bazel2) This ensure that the build of bazel is a fixed point. Change-Id: I422dfc7ec5b95aa054a2677e59427cbd8cd4ef01 PiperOrigin-RevId: 166180529 --- scripts/bootstrap/bootstrap.sh | 51 ------------------------------------------ 1 file changed, 51 deletions(-) (limited to 'scripts/bootstrap/bootstrap.sh') diff --git a/scripts/bootstrap/bootstrap.sh b/scripts/bootstrap/bootstrap.sh index c50afc249a..eeac8d1d20 100755 --- a/scripts/bootstrap/bootstrap.sh +++ b/scripts/bootstrap/bootstrap.sh @@ -79,54 +79,3 @@ function bazel_build() { function get_bazel_bin_path() { _run_bootstrapping_bazel info "bazel-bin" || echo "bazel-bin" } - -function md5_outputs() { - [ -n "${BAZEL_TEST_XTRACE:-}" ] && set +x # Avoid garbage in the output - # runfiles/MANIFEST & runfiles_manifest contain absolute path, ignore. - # ar on OS-X is non-deterministic, ignore .a files. - for i in $(find bazel-bin/ -type f -a \! -name MANIFEST -a \! -name '*.runfiles_manifest' -a \! -name '*.a'); do - md5_file $i - done - for i in $(find bazel-genfiles/ -type f); do - md5_file $i - done - [ -n "${BAZEL_TEST_XTRACE:-}" ] && set -x -} - -function get_outputs_sum() { - md5_outputs | sort -k 2 -} - -function bootstrap_test() { - local BAZEL_BIN=$1 - local BAZEL_SUM=$2 - local BAZEL_TARGET=${3:-src:bazel} - local STRATEGY="--strategy=Javac=worker --worker_quit_after_build" - if [ "${JAVA_VERSION}" = "1.7" ]; then - STRATEGY= - fi - [ -x "${BAZEL_BIN}" ] || fail "syntax: bootstrap bazel-binary" - run ${BAZEL_BIN} --nomaster_bazelrc --bazelrc=${BAZELRC} \ - ${BAZEL_DIR_STARTUP_OPTIONS} \ - clean \ - --expunge || return $? - run ${BAZEL_BIN} --nomaster_bazelrc --bazelrc=${BAZELRC} \ - ${BAZEL_DIR_STARTUP_OPTIONS} \ - build \ - ${EXTRA_BAZEL_ARGS-} ${STRATEGY} \ - --fetch --nostamp \ - --define "JAVA_VERSION=${JAVA_VERSION}" \ - --javacopt="-g -source ${JAVA_VERSION} -target ${JAVA_VERSION}" \ - ${BAZEL_TARGET} || return $? - if [ -n "${BAZEL_SUM}" ]; then - cat bazel-genfiles/src/java.version >${BAZEL_SUM} - get_outputs_sum >> ${BAZEL_SUM} || return $? - fi - if [ -z "${BOOTSTRAP:-}" ]; then - tempdir - BOOTSTRAP=${NEW_TMPDIR}/bazel - local FILE=bazel-bin/${BAZEL_TARGET##//} - cp -f ${FILE/:/\/} $BOOTSTRAP - chmod +x $BOOTSTRAP - fi -} -- cgit v1.2.3