aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar philwo <philwo@google.com>2018-07-30 05:24:50 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-30 05:26:16 -0700
commitd6ce2643811b7814be43e4a6763c1663412831fe (patch)
treeca9119d84d8e3051ab4c5405c37b7bf013f202f3 /src/test/shell
parentfeb9c8759ec0fb310a5f0ede37e70f3403debb28 (diff)
Make the fallback strategy for Bazel's remote execution configurable.
RELNOTES: When using Bazel's remote execution feature and Bazel has to fallback to local execution for an action, Bazel used non-sandboxed local execution until now. From this release on, you can use the new flag --remote_local_fallback_strategy=<strategy> to tell Bazel which strategy to use in that case. PiperOrigin-RevId: 206566380
Diffstat (limited to 'src/test/shell')
-rwxr-xr-xsrc/test/shell/bazel/remote/remote_execution_test.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/shell/bazel/remote/remote_execution_test.sh b/src/test/shell/bazel/remote/remote_execution_test.sh
index d5e0b9fad9..9b2ac86c65 100755
--- a/src/test/shell/bazel/remote/remote_execution_test.sh
+++ b/src/test/shell/bazel/remote/remote_execution_test.sh
@@ -171,6 +171,54 @@ EOF
# TODO(ulfjack): Check that the test failure gets reported correctly.
}
+function test_local_fallback_works_with_local_strategy() {
+ mkdir -p gen1
+ cat > gen1/BUILD <<'EOF'
+genrule(
+name = "gen1",
+srcs = [],
+outs = ["out1"],
+cmd = "touch \"$@\"",
+tags = ["no-remote"],
+)
+EOF
+
+ bazel build \
+ --spawn_strategy=remote \
+ --remote_executor=localhost:${worker_port} \
+ --remote_local_fallback_strategy=local \
+ --build_event_text_file=gen1.log \
+ //gen1 >& $TEST_log \
+ || fail "Expected success"
+
+ mv gen1.log $TEST_log
+ expect_log "1 process: 1 local"
+}
+
+function test_local_fallback_works_with_sandboxed_strategy() {
+ mkdir -p gen2
+ cat > gen2/BUILD <<'EOF'
+genrule(
+name = "gen2",
+srcs = [],
+outs = ["out2"],
+cmd = "touch \"$@\"",
+tags = ["no-remote"],
+)
+EOF
+
+ bazel build \
+ --spawn_strategy=remote \
+ --remote_executor=localhost:${worker_port} \
+ --remote_local_fallback_strategy=sandboxed \
+ --build_event_text_file=gen2.log \
+ //gen2 >& $TEST_log \
+ || fail "Expected success"
+
+ mv gen2.log $TEST_log
+ expect_log "1 process: 1 .*-sandbox"
+}
+
function is_file_uploaded() {
h=$(shasum -a256 < $1)
if [ -e "$cas_path/${h:0:64}" ]; then return 0; else return 1; fi