diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java index 79ecce1b46e507..a86323496d6b8c 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java @@ -65,6 +65,7 @@ public RunfilesSupplierImpl( PathFragment runfilesDir, Runfiles runfiles, @Nullable Artifact manifest) { + Preconditions.checkArgument(!runfilesDir.isAbsolute()); this.runfilesDir = Preconditions.checkNotNull(runfilesDir); this.runfiles = Preconditions.checkNotNull(runfiles); this.manifest = manifest; diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java index ac42e147aa4270..f338d2b2cfe7e9 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java @@ -118,7 +118,7 @@ public void exec(TestRunnerAction action, ActionExecutionContext actionExecution ImmutableMap.copyOf(env), ImmutableMap.copyOf(info), new RunfilesSupplierImpl( - runfilesDir.asFragment(), action.getExecutionSettings().getRunfiles()), + runfilesDir.relativeTo(execRoot), action.getExecutionSettings().getRunfiles()), /*inputs=*/ImmutableList.copyOf(action.getInputs()), /*tools=*/ImmutableList.of(), /*filesetManifests=*/ImmutableList.of(), diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/SpawnHelpers.java b/src/main/java/com/google/devtools/build/lib/sandbox/SpawnHelpers.java index 28a0b2a4dc13a1..d8bb0a7f5835e8 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/SpawnHelpers.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/SpawnHelpers.java @@ -145,9 +145,7 @@ void mountRunfilesFromSuppliers(Map mounts, Spawn spawn) thr for (Map.Entry> rootAndMappings : rootsAndMappings.entrySet()) { PathFragment root = rootAndMappings.getKey(); - if (root.isAbsolute()) { - root = root.relativeTo(execRoot.asFragment()); - } + Preconditions.checkState(!root.isAbsolute()); for (Map.Entry mapping : rootAndMappings.getValue().entrySet()) { Artifact sourceArtifact = mapping.getValue(); Path source = diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java index 150ed7acca97ec..8aef0e6bed9918 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java @@ -353,7 +353,7 @@ public void testInputManifestsRemovedIfSupplied() throws Exception { Action[] actions = builder() .addInput(manifest) .addRunfilesSupplier( - new RunfilesSupplierImpl(new PathFragment("/destination/"), Runfiles.EMPTY, manifest)) + new RunfilesSupplierImpl(new PathFragment("destination"), Runfiles.EMPTY, manifest)) .addOutput(getBinArtifactWithNoOwner("output")) .setExecutable(scratch.file("/bin/xxx").asFragment()) .setProgressMessage("Test")