aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
diff options
context:
space:
mode:
authorGravatar shahan <shahan@google.com>2018-03-15 14:18:46 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-15 14:20:29 -0700
commit18726b7e62ab40fa7d1531af7f72fca17abcdb0a (patch)
tree5da2d9407b172bfefc58202ca6901bc54040490b /src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
parent31032f5a089ded7ebeeb2786eb91864ac58e3306 (diff)
Begins cleanup to allow ActionFS to be injected into all action executions.
PiperOrigin-RevId: 189244665
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java33
1 files changed, 21 insertions, 12 deletions
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 2dfc22904d..93134e8ef0 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
@@ -164,13 +164,18 @@ public class StandaloneTestStrategy extends TestStrategy {
}
processLastTestAttempt(attempt, dataBuilder, standaloneTestResult.testResultData());
ImmutableList.Builder<Pair<String, Path>> testOutputsBuilder = new ImmutableList.Builder<>();
- if (action.getTestLog().getPath().exists()) {
+ if (actionExecutionContext.getInputPath(action.getTestLog()).exists()) {
testOutputsBuilder.add(
- Pair.of(TestFileNameConstants.TEST_LOG, action.getTestLog().getPath()));
+ Pair.of(
+ TestFileNameConstants.TEST_LOG,
+ actionExecutionContext.getInputPath(action.getTestLog())));
}
- if (action.getCoverageData() != null && action.getCoverageData().getPath().exists()) {
+ if (action.getCoverageData() != null
+ && actionExecutionContext.getInputPath(action.getCoverageData()).exists()) {
testOutputsBuilder.add(
- Pair.of(TestFileNameConstants.TEST_COVERAGE, action.getCoverageData().getPath()));
+ Pair.of(
+ TestFileNameConstants.TEST_COVERAGE,
+ actionExecutionContext.getInputPath(action.getCoverageData())));
}
testOutputsBuilder.addAll(TestResult.testOutputsFromPaths(resolvedPaths));
actionExecutionContext
@@ -207,18 +212,21 @@ public class StandaloneTestStrategy extends TestStrategy {
// Rename outputs
String namePrefix =
FileSystemUtils.removeExtension(action.getTestLog().getExecPath().getBaseName());
- Path testRoot = action.getTestLog().getPath().getParentDirectory();
+ Path testRoot = actionExecutionContext.getInputPath(action.getTestLog()).getParentDirectory();
Path attemptsDir = testRoot.getChild(namePrefix + "_attempts");
attemptsDir.createDirectory();
String attemptPrefix = "attempt_" + attempt;
Path testLog = attemptsDir.getChild(attemptPrefix + ".log");
- if (action.getTestLog().getPath().exists()) {
- action.getTestLog().getPath().renameTo(testLog);
+ if (actionExecutionContext.getInputPath(action.getTestLog()).exists()) {
+ actionExecutionContext.getInputPath(action.getTestLog()).renameTo(testLog);
testOutputsBuilder.add(Pair.of(TestFileNameConstants.TEST_LOG, testLog));
}
- if (action.getCoverageData() != null && action.getCoverageData().getPath().exists()) {
+ if (action.getCoverageData() != null
+ && actionExecutionContext.getInputPath(action.getCoverageData()).exists()) {
testOutputsBuilder.add(
- Pair.of(TestFileNameConstants.TEST_COVERAGE, action.getCoverageData().getPath()));
+ Pair.of(
+ TestFileNameConstants.TEST_COVERAGE,
+ actionExecutionContext.getInputPath(action.getCoverageData())));
}
// Get the normal test output paths, and then update them to use "attempt_N" names, and
@@ -300,8 +308,9 @@ public class StandaloneTestStrategy extends TestStrategy {
prepareFileSystem(action, tmpDir, coverageDir, workingDirectory);
try (FileOutErr fileOutErr =
- new FileOutErr(
- action.getTestLog().getPath(), action.resolve(execRoot).getTestStderr())) {
+ new FileOutErr(
+ actionExecutionContext.getInputPath(action.getTestLog()),
+ action.resolve(execRoot).getTestStderr())) {
StandaloneTestResult standaloneTestResult =
executeTest(action, spawn, actionExecutionContext.withFileOutErr(fileOutErr));
appendStderr(fileOutErr.getOutputPath(), fileOutErr.getErrorPath());
@@ -334,7 +343,7 @@ public class StandaloneTestStrategy extends TestStrategy {
TestRunnerAction action, Spawn spawn, ActionExecutionContext actionExecutionContext)
throws ExecException, InterruptedException, IOException {
Closeable streamed = null;
- Path testLogPath = action.getTestLog().getPath();
+ Path testLogPath = actionExecutionContext.getInputPath(action.getTestLog());
TestResultData.Builder builder = TestResultData.newBuilder();
long startTime = actionExecutionContext.getClock().currentTimeMillis();