use of com.google.devtools.build.lib.actions.RunfilesSupplier in project bazel by bazelbuild.
the class SpawnInputExpanderTest method testRunfilesDirectoryStrict.
@Test
public void testRunfilesDirectoryStrict() throws Exception {
Artifact artifact = new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(new PathFragment("runfiles"), runfiles);
ActionInputFileCache mockCache = Mockito.mock(ActionInputFileCache.class);
Mockito.when(mockCache.isFile(artifact)).thenReturn(false);
try {
expander.addRunfilesToInputs(inputMappings, supplier, mockCache);
fail();
} catch (IOException expected) {
assertThat(expected.getMessage().contains("Not a file: /root/dir/file")).isTrue();
}
}
use of com.google.devtools.build.lib.actions.RunfilesSupplier in project bazel by bazelbuild.
the class SpawnInputExpanderTest method testEmptyRunfiles.
@Test
public void testEmptyRunfiles() throws Exception {
RunfilesSupplier supplier = EmptyRunfilesSupplier.INSTANCE;
expander.addRunfilesToInputs(inputMappings, supplier, null);
assertThat(inputMappings).isEmpty();
}
use of com.google.devtools.build.lib.actions.RunfilesSupplier in project bazel by bazelbuild.
the class SpawnInputExpanderTest method testRunfilesTwoFiles.
@Test
public void testRunfilesTwoFiles() throws Exception {
Artifact artifact1 = new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
Artifact artifact2 = new Artifact(fs.getPath("/root/dir/baz"), Root.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact1).addArtifact(artifact2).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(new PathFragment("runfiles"), runfiles);
ActionInputFileCache mockCache = Mockito.mock(ActionInputFileCache.class);
Mockito.when(mockCache.isFile(artifact1)).thenReturn(true);
Mockito.when(mockCache.isFile(artifact2)).thenReturn(true);
expander.addRunfilesToInputs(inputMappings, supplier, mockCache);
assertThat(inputMappings).hasSize(2);
assertThat(inputMappings).containsEntry(new PathFragment("runfiles/workspace/dir/file"), artifact1);
assertThat(inputMappings).containsEntry(new PathFragment("runfiles/workspace/dir/baz"), artifact2);
}
use of com.google.devtools.build.lib.actions.RunfilesSupplier in project bazel by bazelbuild.
the class SpawnInputExpanderTest method testRunfilesSingleFile.
@Test
public void testRunfilesSingleFile() throws Exception {
Artifact artifact = new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(new PathFragment("runfiles"), runfiles);
ActionInputFileCache mockCache = Mockito.mock(ActionInputFileCache.class);
Mockito.when(mockCache.isFile(artifact)).thenReturn(true);
expander.addRunfilesToInputs(inputMappings, supplier, mockCache);
assertThat(inputMappings).hasSize(1);
assertThat(inputMappings).containsEntry(new PathFragment("runfiles/workspace/dir/file"), artifact);
}
use of com.google.devtools.build.lib.actions.RunfilesSupplier in project bazel by bazelbuild.
the class RunfilesSupplierImplTest method testGetManifestsWhenNone.
@Test
public void testGetManifestsWhenNone() {
RunfilesSupplier underTest = new RunfilesSupplierImpl(new PathFragment("ignored"), Runfiles.EMPTY, null);
assertThat(underTest.getManifests()).isEmpty();
}
Aggregations