diff options
author | Kristina Chodorow <kchodorow@google.com> | 2015-08-12 11:35:07 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-08-12 15:23:48 +0000 |
commit | 1782a8f812a25f40e8134acd6be686235117006d (patch) | |
tree | ebd9a9250cf993e28c2c84dda26b5052597cab13 /src/test | |
parent | 77df35ecda687ea996fe5ead3c5d38d3bc2c59ed (diff) |
Use full package identifier in containing package check
Otherwise a @x//a/b will be seen as crossing @y//a's package boundary.
--
MOS_MIGRATED_REVID=100465538
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/shell/bazel/local_repository_test.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/shell/bazel/local_repository_test.sh b/src/test/shell/bazel/local_repository_test.sh index 4697660d26..b1e7d5125b 100755 --- a/src/test/shell/bazel/local_repository_test.sh +++ b/src/test/shell/bazel/local_repository_test.sh @@ -614,4 +614,51 @@ EOF bazel build //:m } +function test_remote_pkg_boundaries() { + other_ws=$TEST_TMPDIR/ws + mkdir -p $other_ws/a + touch $other_ws/WORKSPACE + cat > $other_ws/a/b <<EOF +abcxyz +EOF + cat > $other_ws/BUILD <<EOF +exports_files(["a/b"]) +EOF + cat > WORKSPACE <<EOF +local_repository( + name = "other", + path = "$other_ws", +) +EOF + cat > BUILD <<EOF +load('/sample', 'sample_bin') + +sample_bin( + name = "x", +) +EOF + cat > sample.bzl <<EOF +def impl(ctx): + ctx.action( + command = "cat %s > %s" % (ctx.file._dep.path, ctx.outputs.sh.path), + outputs = [ctx.outputs.sh] + ) + +sample_bin = rule( + attrs = { + '_dep': attr.label( + default=Label("@other//:a/b"), + executable=True, + allow_files=True, + single_file=True) + }, + outputs = {'sh': "%{name}.sh"}, + implementation = impl, +) +EOF + + bazel build -s //:x + assert_contains "abcxyz" bazel-bin/x.sh +} + run_suite "local repository tests" |