Skip to content

Commit

Permalink
Fix //src/test/shell/bazel/remote:remote_execution_test test
Browse files Browse the repository at this point in the history
The stop_worker function in remote_utils.sh was broken with an unbounded
variable error. This error somehow shadowed the return code of the test
cases on macOS.

Fixes #12377
Fixes #12376

Closes #12629.

PiperOrigin-RevId: 346038409
  • Loading branch information
meteorcloudy authored and copybara-github committed Dec 7, 2020
1 parent d113d74 commit 81e570c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/test/shell/bazel/remote/remote_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
REMOTE_WORKER="$(rlocation io_bazel/src/tools/remote/worker)"

function start_worker() {
work_path=$(mktemp -d "${TEST_TMPDIR}/remote.XXXXXXXX")
cas_path=$(mktemp -d "${TEST_TMPDIR}/remote.XXXXXXXX")
pid_file=$(mktemp -u "${TEST_TMPDIR}/remote.XXXXXXXX")
work_path="${TEST_TMPDIR}/remote.work_path"
cas_path="${TEST_TMPDIR}/remote.cas_path"
pid_file="${TEST_TMPDIR}/remote.pid_file"
mkdir -p "${work_path}"
mkdir -p "${cas_path}"
worker_port=$(pick_random_unused_tcp_port) || fail "no port found"
native_lib="${BAZEL_RUNFILES}/src/main/native/"
"${REMOTE_WORKER}" \
Expand All @@ -43,10 +45,13 @@ function start_worker() {
}

function stop_worker() {
work_path="${TEST_TMPDIR}/remote.work_path"
cas_path="${TEST_TMPDIR}/remote.cas_path"
pid_file="${TEST_TMPDIR}/remote.pid_file"
if [ -s "${pid_file}" ]; then
local pid=$(cat "${pid_file}")
kill -9 "${pid}"
rm -rf "${pid_file}"
rm -rf "${pid_file}"
fi
if [ -d "${work_path}" ]; then
rm -rf "${work_path}"
Expand Down

0 comments on commit 81e570c

Please sign in to comment.