From 19740b55ebc283b7ec42b359bcd4c9096facfdd5 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 21 Apr 2022 01:25:11 -0700 Subject: [PATCH] Improve the --sandbox_debug error message This makes it more clear that this flag has another benefit besides verbose logging, similar to the help message for it. Closes #15273. PiperOrigin-RevId: 443307103 --- .../build/lib/sandbox/AbstractSandboxSpawnRunner.java | 3 ++- src/test/shell/bazel/bazel_sandboxing_test.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java index 88b0af4f710bc8..54c88c80a74948 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java @@ -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; diff --git a/src/test/shell/bazel/bazel_sandboxing_test.sh b/src/test/shell/bazel/bazel_sandboxing_test.sh index ef84ca980a0017..3e421533d977df 100755 --- a/src/test/shell/bazel/bazel_sandboxing_test.sh +++ b/src/test/shell/bazel/bazel_sandboxing_test.sh @@ -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. }