aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar laszlocsomor <laszlocsomor@google.com>2017-09-18 10:53:00 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-09-18 11:29:27 +0200
commit66068997980bb3b4ee3d63f08ee16fc58c443864 (patch)
tree3b8e5b9b8edc83dac5466677ec0c69d6b29f86c1 /src
parent7d67e02616c198f5cb8947cd813e313c819047ec (diff)
bazel_bootstrap_distfile_test: fix unbound vars
When printing envvars, use "${FOO:-}" instead of "${FOO}", so the test won't fail if an envvar is undefined. See https://github.com/bazelbuild/bazel/issues/3618 PiperOrigin-RevId: 169059836
Diffstat (limited to 'src')
-rwxr-xr-xsrc/test/shell/bazel/bazel_bootstrap_distfile_test.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh b/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
index 2af654b7b5..62a7ceb407 100755
--- a/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
+++ b/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
@@ -34,33 +34,36 @@ function log_progress() {
# TODO(laszlocsomor): remove this method after we fixed
# https://github.com/bazelbuild/bazel/issues/3618. I added this method only to
# catch that bug.
- echo "DEBUG[$0 $(date)] test_bootstrap, $@"
+ echo "DEBUG[$(basename "$0") $(date)] test_bootstrap, $@"
}
function test_bootstrap() {
local olddir=$(pwd)
WRKDIR=$(mktemp -d ${TEST_TMPDIR}/bazelbootstrap.XXXXXXXX)
log_progress "WRKDIR=($WRKDIR)"
- log_progress "TMPDIR=($TMPDIR)"
- log_progress "TEST_TMPDIR=($TEST_TMPDIR)"
+ log_progress "TMP=(${TMP:-})"
+ log_progress "TEMP=(${TEMP:-})"
+ log_progress "TMPDIR=(${TMPDIR:-})"
+ log_progress "TEST_TMPDIR=(${TEST_TMPDIR:-})"
+ log_progress "DISTFILE=(${DISTFILE:-})"
mkdir -p "${WRKDIR}" || fail "Could not create workdir"
trap "rm -rf \"$WRKDIR\"" EXIT
cd "${WRKDIR}" || fail "Could not change to work directory"
- unzip -q ${DISTFILE}
- log_progress "unzipped DISTFILE=($DISTFILE)"
+ unzip -q "${DISTFILE}"
+ log_progress "unzipped DISTFILE"
find . -type f -exec chmod u+w {} \;
log_progress "running compile.sh"
./compile.sh || fail "Expected to be able to bootstrap bazel"
- log_progress "done running compile.sh, WRKDIR contains this many files: $(find "$WRKDIR" -type f | wc -l)"
+ log_progress "done running compile.sh, WRKDIR contains this many files: $(find "$WRKDIR" -type f | wc -l || echo "(command failed)")"
log_progress "running bazel info install_base"
# TODO(laszlocsomor): remove the "bazel info install_base" call at the same
# time as removing log_progress, i.e. after we fixed
# https://github.com/bazelbuild/bazel/issues/3618
./output/bazel info install_base || fail "Generated bazel not working"
- log_progress "done running bazel info install_base, WRKDIR contains this many files: $(find "$WRKDIR" -type f | wc -l)"
+ log_progress "done running bazel info install_base, WRKDIR contains this many files: $(find "$WRKDIR" -type f | wc -l || echo "(command failed)")"
log_progress "running bazel info version"
./output/bazel version || fail "Generated bazel not working"
- log_progress "done running bazel version, WRKDIR contains this many files: $(find "$WRKDIR" -type f | wc -l)"
+ log_progress "done running bazel version, WRKDIR contains this many files: $(find "$WRKDIR" -type f | wc -l || echo "(command failed)")"
log_progress "running bazel shutdown"
./output/bazel shutdown
log_progress "done running bazel shutdown"