aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/bazel
diff options
context:
space:
mode:
authorGravatar Yue Gan <yueg@google.com>2016-04-12 14:10:27 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-04-13 08:08:47 +0000
commit6b88e159d97df777716d5fb3eb137f305882602d (patch)
treef32862f7d79c2c692f68b5ded298d240bb61fc26 /src/test/shell/bazel
parent6cb8d820689ad029a9d0dc4ee1100db9b2d96515 (diff)
More detailed error message for sandbox failures in test, when --sandbox_debug and --verbose_failures are on. See discussion in #1049.
RELNOTES: -- MOS_MIGRATED_REVID=119635080
Diffstat (limited to 'src/test/shell/bazel')
-rwxr-xr-xsrc/test/shell/bazel/bazel_sandboxing_test.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_sandboxing_test.sh b/src/test/shell/bazel/bazel_sandboxing_test.sh
index d0f9089764..27097bc9c1 100755
--- a/src/test/shell/bazel/bazel_sandboxing_test.sh
+++ b/src/test/shell/bazel/bazel_sandboxing_test.sh
@@ -418,6 +418,22 @@ function test_sandbox_add_path_workspace_child() {
expect_log "Mounting subdirectory of WORKSPACE or OUTPUTBASE to sandbox is not allowed"
}
+function test_sandbox_fail_command() {
+ mkdir -p "javatests/orange"
+ echo "java_test(name = 'Orange', srcs = ['Orange.java'])" > javatests/orange/BUILD
+ cat > javatests/orange/Orange.java <<EOF
+package orange;
+import junit.framework.TestCase;
+public class Orange extends TestCase {
+ public void testFails() { fail("juice"); }
+}
+EOF
+ bazel test --sandbox_debug --verbose_failures //javatests/orange:Orange >& $TEST_log \
+ && fail "Expected failure" || true
+
+ expect_log "Sandboxed execution failed, which may be legitimate"
+}
+
# The test shouldn't fail if the environment doesn't support running it.
check_supported_platform || exit 0
check_sandbox_allowed || exit 0