diff options
author | 2017-02-10 11:03:10 +0000 | |
---|---|---|
committer | 2017-02-10 15:36:06 +0000 | |
commit | a5294e6a48a0c6ff6ef5eec918489f8564b40824 (patch) | |
tree | 6ecd3768d5560ff4688cacc12818e2a8a1278a98 /src/test | |
parent | d2cba292a6904d188d5a903d5baee3ba873b0ec5 (diff) |
Fix building python zip when middleman runfile is used
When adding a binary A into data attribute of a py_bianry B, a middleman
runfile is used to ensure B's runfiles includes A's runfiles. But this
middlman runfile is not really created, so it should not be zipped.
Fixed: https://github.com/bazelbuild/bazel/issues/2088
--
Change-Id: Id1a99c66cd8027e945883cf4367f003bccd73473
Reviewed-on: https://cr.bazel.build/8772
PiperOrigin-RevId: 147137055
MOS_MIGRATED_REVID=147137055
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/shell/bazel/bazel_rules_test.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_rules_test.sh b/src/test/shell/bazel/bazel_rules_test.sh index ebd65cf635..c4efbf0bc7 100755 --- a/src/test/shell/bazel/bazel_rules_test.sh +++ b/src/test/shell/bazel/bazel_rules_test.sh @@ -396,6 +396,23 @@ EOF expect_log "The number is 42" } +function test_build_python_zip_with_middleman() { + mkdir py + touch py/data.txt + cat > py/BUILD <<EOF +py_binary(name = "bin", srcs = ["bin.py"], data = ["data.txt"]) +py_binary(name = "bin2", srcs = ["bin2.py"], data = [":bin"]) +EOF + cat > py/bin.py <<EOF +print("hello") +EOF + cat > py/bin2.py <<EOF +print("world") +EOF + bazel build --build_python_zip //py:bin2 || fail "build failed" + unzip -l ./bazel-bin/py/bin2 | grep "data.txt" || fail "failed to zip data file" +} + function test_build_with_aliased_input_file() { mkdir -p a cat > a/BUILD <<EOF |