Skip to content

Commit

Permalink
Add integration tests for bazelbuild#17195.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 502341854
Change-Id: I2d5d60d218359621b91f48528aa0b49c319db767
  • Loading branch information
coeuvre authored and copybara-github committed Jan 16, 2023
1 parent 2afa6bf commit 2b22bf0
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/test/shell/bazel/remote/build_without_the_bytes_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,64 @@ EOF
|| fail "Expected test binary bazel-bin/a/test to be downloaded"
}

function do_test_non_test_toplevel_targets() {
# Regression test for https://github.com/bazelbuild/bazel/issues/17190.
#
# Test that when using --remote_download_toplevel with bazel test, outputs of
# non-test targets are downloaded. When using --remote_download_minimal with
# bazel test, outputs of non-test targets are not downloaded.

mkdir -p a
cat > a/BUILD <<'EOF'
genrule(
name = "foo",
srcs = [],
outs = ["foo.txt"],
cmd = "echo \"foo\" > \"$@\"",
)
cc_test(
name = 'test',
srcs = [ 'test.cc' ],
)
EOF
cat > a/test.cc <<EOF
#include <iostream>
int main() { std::cout << "Hello test!" << std::endl; return 0; }
EOF

bazel test \
--remote_executor=grpc://localhost:${worker_port} \
$@ \
//a/... || fail "failed to test"
}

function test_non_test_toplevel_targets_toplevel() {
if [[ "$PLATFORM" == "darwin" ]]; then
# TODO(b/37355380): This test is disabled due to RemoteWorker not supporting
# setting SDKROOT and DEVELOPER_DIR appropriately, as is required of
# action executors in order to select the appropriate Xcode toolchain.
return 0
fi

do_test_non_test_toplevel_targets --remote_download_toplevel

[[ -f bazel-bin/a/foo.txt ]] || fail "Expected a/foo.txt to be downloaded"
}

function test_non_test_toplevel_targets_minimal() {
if [[ "$PLATFORM" == "darwin" ]]; then
# TODO(b/37355380): This test is disabled due to RemoteWorker not supporting
# setting SDKROOT and DEVELOPER_DIR appropriately, as is required of
# action executors in order to select the appropriate Xcode toolchain.
return 0
fi

do_test_non_test_toplevel_targets --remote_download_minimal

[[ ! -f bazel-bin/a/foo.txt ]] || fail "Expected a/foo.txt to not be downloaded"
}

function test_downloads_minimal_bep() {
# Test that when using --remote_download_minimal all URI's in the BEP
# are rewritten as bytestream://..
Expand Down

0 comments on commit 2b22bf0

Please sign in to comment.