aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar cparsons <cparsons@google.com>2018-06-26 14:15:18 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-26 14:17:15 -0700
commitfba7cfb0513595240e9c95a48f37be6bd8b7a448 (patch)
tree0f131fa90f6acfcbbeb50465213696c83bf379a4 /src/test/java/com/google/devtools/build/lib
parent5d85e75601b1c82bbc1358d399afa3e07e87a766 (diff)
Make DefaultInfo.default_runfiles return all runfiles if the runfiles field of DefaultInfo() was used.
RELNOTES: None. PiperOrigin-RevId: 202192091
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java
index 234899fbf0..db9f87ae46 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java
@@ -616,6 +616,34 @@ public class SkylarkIntegrationTest extends BuildViewTestCase {
}
@Test
+ public void testDefaultInfoWithRunfilesConstructor() throws Exception {
+ scratch.file(
+ "pkg/BUILD",
+ "sh_binary(name = 'tryme',",
+ " srcs = [':tryme.sh'],",
+ " visibility = ['//visibility:public'],",
+ ")");
+
+ scratch.file(
+ "src/rulez.bzl",
+ "def _impl(ctx):",
+ " info = DefaultInfo(runfiles = ctx.runfiles(files=[ctx.executable.dep]))",
+ " if info.default_runfiles.files.to_list()[0] != ctx.executable.dep:",
+ " fail('expected runfile to be in info.default_runfiles')",
+ " return [info]",
+ "r = rule(_impl,",
+ " attrs = {",
+ " 'dep' : attr.label(executable = True, mandatory = True, cfg = 'host'),",
+ " }",
+ ")");
+
+ scratch.file(
+ "src/BUILD", "load(':rulez.bzl', 'r')", "r(name = 'r_tools', dep = '//pkg:tryme')");
+
+ assertThat(getConfiguredTarget("//src:r_tools")).isNotNull();
+ }
+
+ @Test
public void testInstrumentedFilesProviderWithCodeCoverageDiabled() throws Exception {
scratch.file(
"test/skylark/extension.bzl",