|
36 | 36 | import com.google.devtools.build.lib.actions.cache.VirtualActionInput;
|
37 | 37 | import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
|
38 | 38 | import com.google.devtools.build.lib.clock.JavaClock;
|
| 39 | +import com.google.devtools.build.lib.exec.SpawnInputExpander; |
39 | 40 | import com.google.devtools.build.lib.remote.options.RemoteOptions;
|
40 | 41 | import com.google.devtools.build.lib.remote.util.DigestUtil;
|
41 | 42 | import com.google.devtools.build.lib.remote.util.InMemoryCacheClient;
|
@@ -74,6 +75,9 @@ public void setUp() throws IOException {
|
74 | 75 | FileSystem fs = new InMemoryFileSystem(new JavaClock(), HASH_FUNCTION);
|
75 | 76 | execRoot = fs.getPath("/exec");
|
76 | 77 | execRoot.createDirectoryAndParents();
|
| 78 | + Path dev = fs.getPath("/dev"); |
| 79 | + dev.createDirectory(); |
| 80 | + dev.setWritable(false); |
77 | 81 | artifactRoot = ArtifactRoot.asDerivedRoot(execRoot, "root");
|
78 | 82 | artifactRoot.getRoot().asPath().createDirectoryAndParents();
|
79 | 83 | options = Options.getDefaults(RemoteOptions.class);
|
@@ -127,6 +131,23 @@ public void testStagingVirtualActionInput() throws Exception {
|
127 | 131 | assertThat(actionInputFetcher.downloadsInProgress).isEmpty();
|
128 | 132 | }
|
129 | 133 |
|
| 134 | + @Test |
| 135 | + public void testStagingEmptyVirtualActionInput() throws Exception { |
| 136 | + // arrange |
| 137 | + MetadataProvider metadataProvider = new StaticMetadataProvider(new HashMap<>()); |
| 138 | + RemoteCache remoteCache = newCache(options, digestUtil, new HashMap<>()); |
| 139 | + RemoteActionInputFetcher actionInputFetcher = |
| 140 | + new RemoteActionInputFetcher(remoteCache, execRoot, RequestMetadata.getDefaultInstance()); |
| 141 | + |
| 142 | + // act |
| 143 | + actionInputFetcher.prefetchFiles( |
| 144 | + ImmutableList.of(SpawnInputExpander.EMPTY_FILE), metadataProvider); |
| 145 | + |
| 146 | + // assert that nothing happened |
| 147 | + assertThat(actionInputFetcher.downloadedFiles()).isEmpty(); |
| 148 | + assertThat(actionInputFetcher.downloadsInProgress).isEmpty(); |
| 149 | + } |
| 150 | + |
130 | 151 | @Test
|
131 | 152 | public void testFileNotFound() throws Exception {
|
132 | 153 | // Test that we get an exception if an input file is missing
|
|
0 commit comments