aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar buchgr <buchgr@google.com>2017-11-30 05:03:24 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-30 05:05:43 -0800
commit3549d761b3ed2120510b316a98fb0a9779feed12 (patch)
tree6fc09d6b4cdd44d72bdc0316ef05cb43139eaf5e /src/test/shell
parentbdf8354790a23884c8e888c6b158d73f8d57e461 (diff)
remote: don't hide non-test failures behind test failures. Fixes #4082
Bazel should display the root cause of a test failure to the user. For example, if a test could not be executed on a remote executor due to there being no network connection, then it shouldn't display the test as failed but tell the user about the network error. RELNOTES: PiperOrigin-RevId: 177439578
Diffstat (limited to 'src/test/shell')
-rwxr-xr-xsrc/test/shell/bazel/remote_execution_test.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/shell/bazel/remote_execution_test.sh b/src/test/shell/bazel/remote_execution_test.sh
index be74814850..17603c4c60 100755
--- a/src/test/shell/bazel/remote_execution_test.sh
+++ b/src/test/shell/bazel/remote_execution_test.sh
@@ -472,6 +472,35 @@ EOF
[ $? -eq 34 ]) || fail "Test failed due to wrong exit code"
}
+# Bazel should display non-test errors to the user, instead of hiding them behind test failures.
+# For example, if the network connection to the remote executor fails it shouldn't be displayed as
+# a test error.
+function test_display_non_testerrors() {
+ mkdir -p a
+ cat > a/BUILD <<'EOF'
+sh_test(
+ name = "test",
+ timeout = "short",
+ srcs = ["test.sh"],
+)
+EOF
+ cat > a/test.sh <<'EOF'
+#!/bin/sh
+#This will never run, because the remote side is not reachable.
+EOF
+ chmod +x a/test.sh
+ bazel --host_jvm_args=-Dbazel.DigestFunction=SHA1 test \
+ --spawn_strategy=remote \
+ --remote_executor=bazel.does.not.exist:1234 \
+ --noexperimental_remote_retry \
+ --test_output=all \
+ --test_env=USER=boo \
+ //a:test >& $TEST_log \
+ && fail "Test failure expected" || true
+ expect_not_log "test.log"
+ expect_log "Remote connection/protocol failed"
+}
+
# TODO(alpha): Add a test that fails remote execution when remote worker
# supports sandbox.