aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Han-Wen Nienhuys <hanwen@google.com>2015-06-23 12:39:03 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-06-24 12:07:44 +0000
commitb6f557b4c1b16a1e955dd773e2de9550f10d59fb (patch)
tree55c4ff9ad17623574c074b016a964fd7467408e8 /src/main/java/com/google/devtools
parent0e1680e58f01f3d443f7e68865b5a56b76c9dadf (diff)
Add XML_OUTPUT_FILE to the test environment in Bazel.
-- MOS_MIGRATED_REVID=96663796
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
index ab36eeffb0..ddea658f5f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
@@ -48,7 +48,6 @@ import java.util.Map;
public class StandaloneTestStrategy extends TestStrategy {
// TODO(bazel-team) - add tests for this strategy.
// TODO(bazel-team) - add support for test timeouts.
- // TODO(bazel-team) - add support for parsing XML output.
private final Path workspace;
@@ -76,7 +75,10 @@ public class StandaloneTestStrategy extends TestStrategy {
workspace, actionExecutionContext.getExecutor().getExecRoot(), executionOptions)
.getChild(getTmpDirName(action.getExecutionSettings().getExecutable().getExecPath()));
Path workingDirectory = runfilesDir.getRelative(action.getRunfilesPrefix());
- Map<String, String> env = getEnv(action, runfilesDir, testTmpDir);
+
+ TestRunnerAction.ResolvedPaths resolvedPaths =
+ action.resolve(actionExecutionContext.getExecutor().getExecRoot());
+ Map<String, String> env = getEnv(action, runfilesDir, testTmpDir, resolvedPaths);
Spawn spawn =
new BaseSpawn(
// Bazel lacks much of the tooling for coverage, so we don't attempt to pass a coverage
@@ -129,14 +131,24 @@ public class StandaloneTestStrategy extends TestStrategy {
}
}
- private Map<String, String> getEnv(TestRunnerAction action, Path runfilesDir, Path tmpDir) {
+ private Map<String, String> getEnv(
+ TestRunnerAction action,
+ Path runfilesDir,
+ Path tmpDir,
+ TestRunnerAction.ResolvedPaths resolvedPaths) {
Map<String, String> vars = getDefaultTestEnvironment(action);
BuildConfiguration config = action.getConfiguration();
vars.putAll(config.getDefaultShellEnvironment());
vars.putAll(action.getTestEnv());
+
+ /*
+ * TODO(bazel-team): the paths below are absolute,
+ * making test actions impossible to cache remotely.
+ */
vars.put("TEST_SRCDIR", runfilesDir.getPathString());
vars.put("TEST_TMPDIR", tmpDir.getPathString());
+ vars.put("XML_OUTPUT_FILE", resolvedPaths.getXmlOutputPath().getPathString());
return vars;
}