diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2017-08-23 12:19:25 +0200 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-08-23 13:31:53 +0200 |
commit | da1d416f83942dc1b1b203cdd4d79c47fce7335f (patch) | |
tree | d46df885e930a4a90e6bb9df4a85fc969c3eb963 /scripts/bootstrap | |
parent | 68776e8ed7768d66ae6cf9a5221a973321d79fc5 (diff) |
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
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-x | scripts/bootstrap/bootstrap.sh | 51 |
1 files changed, 0 insertions, 51 deletions
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 -} |