diff options
author | 2015-09-25 15:18:49 +0000 | |
---|---|---|
committer | 2015-09-28 11:39:01 +0000 | |
commit | b393a53c5a3ce2cfd28a42d6362a02401f987543 (patch) | |
tree | 1cdffbcb8a9db946893d63d9ce5310a3b0401f7e /src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java | |
parent | dc7af5392e60b6b98ebaea7ead11d47218a8df03 (diff) |
Find the test setup script based on its basename and not its precise exec path.
This is necessary so that the existence of a script //tools/test:test-setup.sh is not hardcoded into Bazel, which is in turn necessary so that the Bazel tools (//tools/...) are not required to be in the main repository.
--
MOS_MIGRATED_REVID=103943618
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java index 5872fb17a6..84f66cbe3f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java @@ -27,10 +27,12 @@ import com.google.devtools.build.lib.actions.ExecException; import com.google.devtools.build.lib.actions.Executor; import com.google.devtools.build.lib.actions.NotifyOnActionCacheHit; import com.google.devtools.build.lib.actions.ResourceSet; +import com.google.devtools.build.lib.actions.UserExecException; import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.analysis.config.RunUnder; import com.google.devtools.build.lib.cmdline.Label; +import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.util.Fingerprint; import com.google.devtools.build.lib.util.LoggingUtil; import com.google.devtools.build.lib.vfs.FileSystemUtils; @@ -58,6 +60,7 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa private static final String GUID = "94857c93-f11c-4cbc-8c1b-e0a281633f9e"; + private final NestedSet<Artifact> runtime; private final BuildConfiguration configuration; private final Artifact testLog; private final Artifact cacheStatus; @@ -111,6 +114,7 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa */ TestRunnerAction(ActionOwner owner, Iterable<Artifact> inputs, + NestedSet<Artifact> runtime, // Must be a subset of inputs Artifact testLog, Artifact cacheStatus, Artifact coverageArtifact, @@ -126,6 +130,7 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa // Note that this action only cares about the runfiles, not the mapping. new RunfilesSupplierImpl(new PathFragment("runfiles"), executionSettings.getRunfiles()), list(testLog, cacheStatus, coverageArtifact, microCoverageArtifact)); + this.runtime = runtime; this.configuration = Preconditions.checkNotNull(configuration); this.testLog = testLog; this.cacheStatus = cacheStatus; @@ -539,6 +544,16 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa return getOutputs(); } + public Artifact getRuntimeArtifact(String basename) throws ExecException { + for (Artifact runtimeArtifact : runtime) { + if (runtimeArtifact.getExecPath().getBaseName().equals(basename)) { + return runtimeArtifact; + } + } + + throw new UserExecException("'" + basename + "' not found in test runtime"); + } + /** * The same set of paths as the parent test action, resolved against a given exec root. */ |