A list of log paths will be provided in build output.

These log paths are aggregated from the metadataLog field on the SpawnResult.

RELNOTES: A list of log paths will be provided in build output.
PiperOrigin-RevId: 268278303
diff --git a/src/test/java/com/google/devtools/build/lib/actions/SpawnResultTest.java b/src/test/java/com/google/devtools/build/lib/actions/SpawnResultTest.java
index 6bedfc9..7d55123 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/SpawnResultTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/SpawnResultTest.java
@@ -14,8 +14,12 @@
 package com.google.devtools.build.lib.actions;
 
 import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth8.assertThat;
 
+import com.google.devtools.build.lib.actions.SpawnResult.MetadataLog;
 import com.google.devtools.build.lib.actions.SpawnResult.Status;
+import com.google.devtools.build.lib.vfs.Path;
+import com.google.devtools.build.lib.vfs.util.FileSystems;
 import com.google.protobuf.ByteString;
 import java.time.Duration;
 import org.junit.Test;
@@ -70,4 +74,20 @@
     assertThat(r.getInMemoryOutput(null)).isEqualTo(null);
     assertThat(r.getInMemoryOutput(ActionInputHelper.fromPath("/does/not/exist"))).isEqualTo(null);
   }
+
+  @Test
+  public void getSpawnResultLogs() throws Exception {
+    SpawnResult.Builder builder =
+        new SpawnResult.Builder().setStatus(Status.SUCCESS).setExitCode(0).setRunnerName("test");
+
+    assertThat(builder.build().getActionMetadataLog()).isEmpty();
+
+    String logName = "/path/to/logs.txt";
+    Path logPath = FileSystems.getJavaIoFileSystem().getPath(logName);
+    MetadataLog metadataLog = new MetadataLog("test_metadata_log", logPath);
+    SpawnResult withLogs = builder.setActionMetadataLog(metadataLog).build();
+
+    assertThat(withLogs.getActionMetadataLog()).hasValue(metadataLog);
+    assertThat(withLogs.getActionMetadataLog().get().getFilePath()).isEqualTo(logPath);
+  }
 }