Skip to content

Commit

Permalink
Improve the --sandbox_debug error message
Browse files Browse the repository at this point in the history
This makes it more clear that this flag has another benefit besides
verbose logging, similar to the help message for it.

Closes bazelbuild#15273.

PiperOrigin-RevId: 443307103
  • Loading branch information
keith authored and copybara-github committed Apr 21, 2022
1 parent 4ea7d69 commit 19740b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ abstract class AbstractSandboxSpawnRunner implements SpawnRunner {
private static final int LOCAL_EXEC_ERROR = -1;

private static final String SANDBOX_DEBUG_SUGGESTION =
"\n\nUse --sandbox_debug to see verbose messages from the sandbox";
"\n\nUse --sandbox_debug to see verbose messages from the sandbox "
+ "and retain the sandbox build root for debugging";

private final SandboxOptions sandboxOptions;
private final boolean verboseFailures;
Expand Down
4 changes: 2 additions & 2 deletions src/test/shell/bazel/bazel_sandboxing_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -727,13 +727,13 @@ genrule(
EOF
bazel build --verbose_failures :broken &> $TEST_log \
&& fail "build should have failed" || true
expect_log "Use --sandbox_debug to see verbose messages from the sandbox"
expect_log "Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging"
expect_log "Executing genrule //:broken failed"

bazel build --verbose_failures --sandbox_debug :broken &> $TEST_log \
&& fail "build should have failed" || true
expect_log "Executing genrule //:broken failed"
expect_not_log "Use --sandbox_debug to see verbose messages from the sandbox"
expect_not_log "Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging"
# This will appear a lot in the sandbox failure details.
expect_log "/sandbox/" # Part of the path to the sandbox location.
}
Expand Down

0 comments on commit 19740b5

Please sign in to comment.