1#!/bin/bash 2 3# Fail on any error. Treat unset variables an error. Print commands as executed. 4set -eux 5 6# Log environment variables. 7env 8 9# Let the script continue even if "bazel test" fails, so that all tests are 10# always executed. 11exit_code=0 12 13# Log the bazel version for easier debugging. 14bazel version 15bazel test --test_output=errors absl/... || exit_code=$? 16if [[ ! -z "${ABSL_EXPECTED_PYTHON_VERSION}" ]]; then 17 bazel test \ 18 --test_output=errors absl:tests/python_version_test \ 19 --test_arg=--expected_version="${ABSL_EXPECTED_PYTHON_VERSION}" || exit_code=$? 20fi 21 22if [[ ! -z "${ABSL_COPY_TESTLOGS_TO}" ]]; then 23 mkdir -p "${ABSL_COPY_TESTLOGS_TO}" 24 readonly testlogs_dir=$(bazel info bazel-testlogs) 25 echo "Copying bazel test logs from ${testlogs_dir} to ${ABSL_COPY_TESTLOGS_TO}..." 26 cp -r "${testlogs_dir}" "${ABSL_COPY_TESTLOGS_TO}" || exit_code=$? 27fi 28 29# TODO(yileiyang): Update and run smoke_test.sh. 30 31exit $exit_code 32