From 3549d761b3ed2120510b316a98fb0a9779feed12 Mon Sep 17 00:00:00 2001 From: buchgr Date: Thu, 30 Nov 2017 05:03:24 -0800 Subject: 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 --- src/test/shell/bazel/remote_execution_test.sh | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/test/shell') 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. -- cgit v1.2.3