Skip to content

Commit

Permalink
Fix tests that use genrule to produce dir outputs.
Browse files Browse the repository at this point in the history
Outputs of genrule should always be files. One should use `ctx.actions.declare_directory` for directory outputs (bazelbuild@2fe450f).

Without the fix, these tests will fail when building without the bytes.

PiperOrigin-RevId: 543406792
Change-Id: Ia2bcf54d7c173af1ce29d55e7d20dee13a305e55
  • Loading branch information
coeuvre authored and copybara-github committed Jun 26, 2023
1 parent aff3361 commit ed5e660
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/test/shell/bazel/remote/remote_execution_http_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ genrule(
name = "test",
srcs = [":output_dir"],
outs = ["qux"],
cmd = "mkdir $@ && paste -d\"\n\" $(location :output_dir)/foo.txt $(location :output_dir)/sub1/bar.txt > $@/out.txt",
cmd = "paste -d\"\n\" $(location :output_dir)/foo.txt $(location :output_dir)/sub1/bar.txt > $@",
)
sh_binary(
Expand Down Expand Up @@ -215,7 +215,7 @@ function test_directory_artifact_starlark_local() {

bazel build //a:test >& $TEST_log \
|| fail "Failed to build //a:test without remote execution"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Local execution generated different result"
}

Expand All @@ -227,7 +227,7 @@ function test_directory_artifact_starlark() {
--remote_executor=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote execution"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Remote execution generated different result"
bazel clean
bazel build \
Expand All @@ -236,7 +236,7 @@ function test_directory_artifact_starlark() {
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote execution"
expect_log "remote cache hit"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Remote cache hit generated different result"
}

Expand All @@ -247,15 +247,15 @@ function test_directory_artifact_starlark_grpc_cache() {
--remote_cache=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote gRPC cache"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Remote cache miss generated different result"
bazel clean
bazel build \
--remote_cache=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote gRPC cache"
expect_log "remote cache hit"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Remote cache hit generated different result"
}

Expand All @@ -266,15 +266,15 @@ function test_directory_artifact_starlark_http_cache() {
--remote_cache=http://localhost:${http_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote HTTP cache"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Remote cache miss generated different result"
bazel clean
bazel build \
--remote_cache=http://localhost:${http_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote HTTP cache"
expect_log "remote cache hit"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
diff bazel-genfiles/a/qux a/test_expected \
|| fail "Remote cache hit generated different result"
}

Expand Down

0 comments on commit ed5e660

Please sign in to comment.