diff options
author | 2016-08-01 10:59:36 +0000 | |
---|---|---|
committer | 2016-08-01 13:04:55 +0000 | |
commit | 5a4b445fcce2997967510e7f2750e2bace1cfe11 (patch) | |
tree | 6abb27ea6e25e6d152551e508fea39ddd889e668 /src | |
parent | 34d3bf8eaeedd86604990570904fdfac019ac8d2 (diff) |
StandaloneTestStrategy: Pass relative JAVA_RUNFILES and PYTHON_RUNFILES to tests
--
Change-Id: I97319dc2c676100fb8f1224b9dcd6fbc8ec7e5e5
Reviewed-on: https://bazel-review.googlesource.com/#/c/4200/3
MOS_MIGRATED_REVID=128973499
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/BaseSpawn.java | 6 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/BaseSpawn.java b/src/main/java/com/google/devtools/build/lib/actions/BaseSpawn.java index 2e3a69de29..3cfff11438 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/BaseSpawn.java +++ b/src/main/java/com/google/devtools/build/lib/actions/BaseSpawn.java @@ -25,12 +25,10 @@ import com.google.devtools.build.lib.util.CommandDescriptionForm; import com.google.devtools.build.lib.util.CommandFailureUtils; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; - import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; - import javax.annotation.concurrent.Immutable; /** @@ -212,7 +210,9 @@ public class BaseSpawn implements Spawn { @Override public ImmutableMap<String, String> getEnvironment() { PathFragment runfilesRoot = getRunfilesRoot(); - if (runfilesRoot == null) { + if (runfilesRoot == null + || (environment.containsKey("JAVA_RUNFILES") + && environment.containsKey("PYTHON_RUNFILES"))) { return environment; } else { ImmutableMap.Builder<String, String> env = ImmutableMap.builder(); 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 a6562d5065..acce97aefc 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 @@ -156,7 +156,10 @@ public class StandaloneTestStrategy extends TestStrategy { vars.putAll(config.getLocalShellEnvironment()); vars.putAll(action.getTestEnv()); - vars.put("TEST_SRCDIR", runfilesDir.relativeTo(execRoot).getPathString()); + String testSrcDir = runfilesDir.relativeTo(execRoot).getPathString(); + vars.put("JAVA_RUNFILES", testSrcDir); + vars.put("PYTHON_RUNFILES", testSrcDir); + vars.put("TEST_SRCDIR", testSrcDir); vars.put("TEST_TMPDIR", tmpDir.relativeTo(execRoot).getPathString()); vars.put("TEST_WORKSPACE", action.getRunfilesPrefix()); vars.put("XML_OUTPUT_FILE", xmlOutputPath.relativeTo(execRoot).getPathString()); |