-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote: Fix "file not found" error when remote cache is changed from enabled to disabled. #14252
Closed
Closed
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3204,4 +3204,63 @@ EOF | |
expect_not_log "WARNING: Writing to Remote Cache:" | ||
} | ||
|
||
function test_download_toplevel_when_turn_remote_cache_off_without_metadata() { | ||
download_toplevel_when_turn_remote_cache_off | ||
} | ||
|
||
function test_download_toplevel_when_turn_remote_cache_off_with_metadata() { | ||
download_toplevel_when_turn_remote_cache_off --experimental_action_cache_store_output_metadata | ||
} | ||
|
||
function download_toplevel_when_turn_remote_cache_off() { | ||
# Test that BwtB doesn't cause build failure if remote cache is disabled in a following build. | ||
# See https://github.com/bazelbuild/bazel/issues/13882. | ||
|
||
local extra_build_flags="$@" | ||
|
||
cat > .bazelrc <<EOF | ||
build --verbose_failures | ||
EOF | ||
mkdir a | ||
cat > a/BUILD <<'EOF' | ||
genrule( | ||
name = "producer", | ||
outs = ["a.txt", "b.txt"], | ||
cmd = "touch $(OUTS)", | ||
) | ||
|
||
genrule( | ||
name = "consumer", | ||
outs = ["out.txt"], | ||
srcs = [":b.txt", "in.txt"], | ||
cmd = "cat $(SRCS) > $@", | ||
) | ||
EOF | ||
echo 'foo' > a/in.txt | ||
|
||
# populate the cache | ||
bazel build \ | ||
--remote_cache=grpc://localhost:${worker_port} \ | ||
--remote_download_toplevel \ | ||
//a:consumer >& $TEST_log || fail "Failed to populate the cache" | ||
|
||
bazel clean >& $TEST_log || fail "Failed to clean" | ||
|
||
# download top level outputs | ||
bazel build \ | ||
--remote_cache=grpc://localhost:${worker_port} \ | ||
--remote_download_toplevel \ | ||
$extra_build_flags \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect bash linter may not like that -- your best bet may be to use the "$@" array directly or declare and use extra_build_flags as an array and use like that (personally, I recommend
|
||
//a:consumer >& $TEST_log || fail "Failed to download outputs" | ||
[[ -f bazel-bin/a/a.txt ]] || [[ -f bazel-bin/a/b.txt ]] \ | ||
&& fail "Expected outputs of producer are not downloaded" | ||
|
||
# build without remote cache | ||
echo 'bar' > a/in.txt | ||
bazel build \ | ||
--remote_download_toplevel \ | ||
$extra_build_flags \ | ||
//a:consumer >& $TEST_log || fail "Failed to build without remote cache" | ||
} | ||
|
||
run_suite "Remote execution and remote cache tests" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 test cases differ by 1 option only -- why not put the test case as a separate helper function and call that twice with different parameters (Bash tests parameterization). Example here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.