Skip to content

Commit 0847339

Browse files
committed
Add more tests
1 parent f3ab835 commit 0847339

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

src/main/java/com/google/devtools/build/lib/remote/RemoteActionFileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ protected boolean delete(PathFragment path) throws IOException {
371371
@Override
372372
protected InputStream getInputStream(PathFragment path) throws IOException {
373373
try {
374-
materializeFileIfLazy(path);
374+
materializeIfLazy(path);
375375
} catch (BulkTransferException e) {
376376
var newlyLostInputs = e.getLostArtifacts(inputArtifactData::getInput);
377377
if (!newlyLostInputs.isEmpty()) {

src/test/java/com/google/devtools/build/lib/remote/RemoteActionFileSystemTest.java

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -878,10 +878,7 @@ public void createSymbolicLink_localFileArtifact() throws Exception {
878878
// assert
879879
assertThat(symlinkActionFs.getFileSystem()).isSameInstanceAs(actionFs);
880880
assertThat(symlinkActionFs.readSymbolicLink()).isEqualTo(targetPath);
881-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
882-
.isEqualTo(targetPath);
883-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
884-
.isEqualTo(targetPath);
881+
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).exists(Symlinks.NOFOLLOW)).isFalse();
885882
}
886883

887884
@Test
@@ -901,11 +898,8 @@ public void createSymbolicLink_remoteFileArtifact() throws Exception {
901898
// assert
902899
assertThat(symlinkActionFs.getFileSystem()).isSameInstanceAs(actionFs);
903900
assertThat(symlinkActionFs.readSymbolicLink()).isEqualTo(targetPath);
904-
assertThat(outputArtifact.getPath().readSymbolicLink()).isEqualTo(targetPath);
905-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
906-
.isEqualTo(targetPath);
907-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
908-
.isEqualTo(targetPath);
901+
assertThat(outputArtifact.getPath().exists(Symlinks.NOFOLLOW)).isFalse();
902+
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).exists(Symlinks.NOFOLLOW)).isFalse();
909903
}
910904

911905
@Test
@@ -928,10 +922,7 @@ public void createSymbolicLink_localTreeArtifact() throws Exception {
928922
// assert
929923
assertThat(symlinkActionFs.getFileSystem()).isSameInstanceAs(actionFs);
930924
assertThat(symlinkActionFs.readSymbolicLink()).isEqualTo(targetPath);
931-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
932-
.isEqualTo(targetPath);
933-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
934-
.isEqualTo(targetPath);
925+
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).exists(Symlinks.NOFOLLOW)).isFalse();
935926
}
936927

937928
@Test
@@ -954,10 +945,7 @@ public void createSymbolicLink_remoteTreeArtifact() throws Exception {
954945
// assert
955946
assertThat(symlinkActionFs.getFileSystem()).isSameInstanceAs(actionFs);
956947
assertThat(symlinkActionFs.readSymbolicLink()).isEqualTo(targetPath);
957-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
958-
.isEqualTo(targetPath);
959-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
960-
.isEqualTo(targetPath);
948+
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).exists(Symlinks.NOFOLLOW)).isFalse();
961949
}
962950

963951
@Test
@@ -977,10 +965,7 @@ public void createSymbolicLink_unresolvedSymlink() throws Exception {
977965
// assert
978966
assertThat(symlinkActionFs.getFileSystem()).isSameInstanceAs(actionFs);
979967
assertThat(symlinkActionFs.readSymbolicLink()).isEqualTo(targetPath);
980-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
981-
.isEqualTo(targetPath);
982-
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).readSymbolicLink())
983-
.isEqualTo(targetPath);
968+
assertThat(getLocalFileSystem(actionFs).getPath(linkPath).exists(Symlinks.NOFOLLOW)).isFalse();
984969
}
985970

986971
@Test

src/test/shell/bazel/remote/build_without_the_bytes_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,14 +1580,14 @@ EOF
15801580
--remote_download_minimal \
15811581
//a:test0 >& $TEST_log || fail "Failed to test"
15821582
# 2 remote spawns: 1 for executing the test, 1 for generating the test.xml
1583-
expect_log "\d processes:.* 2 remote"
1583+
expect_log ".* processes:.* 2 remote"
15841584

15851585
bazel test \
15861586
--remote_executor=grpc://localhost:${worker_port} \
15871587
--remote_download_minimal \
15881588
//a:test1 >& $TEST_log || fail "Failed to test"
15891589
# only 1 remote spawn: test.xml is generated by junit
1590-
expect_log "\d processes:.* 1 remote"
1590+
expect_log ".* processes:.* 1 remote"
15911591
}
15921592

15931593
function test_output_file_permission() {

0 commit comments

Comments
 (0)