diff options
author | buchgr <buchgr@google.com> | 2017-11-30 05:03:24 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-11-30 05:05:43 -0800 |
commit | 3549d761b3ed2120510b316a98fb0a9779feed12 (patch) | |
tree | 6fc09d6b4cdd44d72bdc0316ef05cb43139eaf5e /src/main/java/com/google | |
parent | bdf8354790a23884c8e888c6b158d73f8d57e461 (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/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java | 11 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java index 41fcb3cd12..be6ed30a48 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java @@ -367,8 +367,15 @@ public class StandaloneTestStrategy extends TestStrategy { .setPassedLog(testLogPath.getPathString()); } catch (SpawnExecException e) { // If this method returns normally, then the higher level will rerun the test (up to - // --flaky_test_attempts times). We don't catch any other ExecException here, so those never - // get retried. + // --flaky_test_attempts times). + if (e.isCatastrophic()) { + // Rethrow as the error was catastrophic and thus the build has to be halted. + throw e; + } + if (!e.getSpawnResult().setupSuccess()) { + // Rethrow as the test could not be run and thus there's no point in retrying. + throw e; + } builder .setTestPassed(false) .setStatus(e.hasTimedOut() ? BlazeTestStatus.TIMEOUT : BlazeTestStatus.FAILED) diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java index 6c4b0a8eda..7672539a6a 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java @@ -249,8 +249,7 @@ class RemoteSpawnRunner implements SpawnRunner { .setStatus(status) .setExitCode(ExitCode.REMOTE_ERROR.getNumericExitCode()) .build(), - /* forciblyRunRemotely= */ false, - /* catastrophe= */ true); + /* forciblyRunRemotely= */ false); } static Action buildAction( |