Regression test for breakage caused by https://github.com/bazelbuild/bazel/commit/3290e22356b59371274849ee51297635b9435285. Fails before fix.
PiperOrigin-RevId: 250693437
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
index ae2bab0..dcee940 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
@@ -167,6 +167,24 @@
}
@Test
+ public void testGetArtifactOwnerInStarlark() throws Exception {
+ scratch.file(
+ "foo/rule.bzl",
+ "def _impl(ctx):",
+ " f = ctx.actions.declare_file('rule_output')",
+ " print('f owner is ' + str(f.owner))",
+ " ctx.actions.write(",
+ " output = f,",
+ " content = 'foo',",
+ " )",
+ "gen = rule(implementation = _impl)");
+ scratch.file("foo/BUILD", "load(':rule.bzl', 'gen')", "gen(name = 'a')");
+
+ update("//foo:a");
+ assertContainsEvent("DEBUG /workspace/foo/rule.bzl:3:3: f owner is //foo:a");
+ }
+
+ @Test
public void testSyntaxErrorInDepPackage() throws Exception {
// Check that a loading error in a dependency is properly reported.
scratch.file("a/BUILD",