diff options
author | Lukacs Berki <lberki@google.com> | 2016-03-30 10:16:28 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-03-30 10:41:08 +0000 |
commit | 6766ebbc7be2b296f7861b25b4c8f373a8503ab3 (patch) | |
tree | ff970c23177fc0015566c5448d531f7ae2a0a4aa /src/main/java/com/google/devtools/build/lib/rules/test | |
parent | 7914d2a316969a3f7232530c3c195b8de50b5786 (diff) |
Use the local shell environment for invoking build-runfiles.
This is necessary because build-runfiles depends on the msys shared library, which (as per DLL lookup rules on Windows) is checked under the entries of PATH.
--
MOS_MIGRATED_REVID=118556684
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/test')
3 files changed, 15 insertions, 11 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 d80fff8caf..a474521544 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 @@ -70,9 +70,8 @@ public class StandaloneTestStrategy extends TestStrategy { throws ExecException, InterruptedException { Path runfilesDir = null; try { - runfilesDir = - TestStrategy.getLocalRunfilesDirectory( - action, actionExecutionContext, binTools, action.getShExecutable()); + runfilesDir = TestStrategy.getLocalRunfilesDirectory(action, actionExecutionContext, binTools, + action.getShExecutable(), action.getLocalShellEnvironment()); } catch (ExecException e) { throw new TestExecException(e.getMessage()); } 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 5f456d7a53..687d6228a4 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 @@ -88,7 +88,6 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa private final int shardNum; private final int runNumber; private final String workspaceName; - private final PathFragment shExecutable; // Mutable state related to test caching. private boolean checkedCaching = false; @@ -168,7 +167,6 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa this.undeclaredOutputsAnnotationsPath = undeclaredOutputsAnnotationsDir.getChild("ANNOTATIONS"); this.testInfrastructureFailure = baseDir.getChild(namePrefix + ".infrastructure_failure"); this.workspaceName = workspaceName; - this.shExecutable = configuration.getShExecutable(); Map<String, String> mergedTestEnv = new HashMap<>(configuration.getTestEnv()); mergedTestEnv.putAll(extraTestEnv); @@ -557,7 +555,11 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa } public PathFragment getShExecutable() { - return shExecutable; + return configuration.getShExecutable(); + } + + public ImmutableMap<String, String> getLocalShellEnvironment() { + return configuration.getLocalShellEnvironment(); } /** diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java index 2ac016bbde..9423f10c27 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java @@ -349,7 +349,8 @@ public abstract class TestStrategy implements TestActionContext { TestRunnerAction testAction, ActionExecutionContext actionExecutionContext, BinTools binTools, - PathFragment shExecutable) + PathFragment shExecutable, + ImmutableMap<String, String> shellEnvironment) throws ExecException, InterruptedException { TestTargetExecutionSettings execSettings = testAction.getExecutionSettings(); @@ -372,8 +373,8 @@ public abstract class TestStrategy implements TestActionContext { long startTime = Profiler.nanoTimeMaybe(); synchronized (execSettings.getInputManifest()) { Profiler.instance().logSimpleTask(startTime, ProfilerTask.WAIT, testAction); - updateLocalRunfilesDirectory( - testAction, runfilesDir, actionExecutionContext, binTools, shExecutable); + updateLocalRunfilesDirectory(testAction, runfilesDir, actionExecutionContext, binTools, + shExecutable, shellEnvironment); } return runfilesDir; @@ -390,7 +391,8 @@ public abstract class TestStrategy implements TestActionContext { Path runfilesDir, ActionExecutionContext actionExecutionContext, BinTools binTools, - PathFragment shExecutable) + PathFragment shExecutable, + ImmutableMap<String, String> shellEnvironment) throws ExecException, InterruptedException { Executor executor = actionExecutionContext.getExecutor(); @@ -413,7 +415,8 @@ public abstract class TestStrategy implements TestActionContext { execSettings.getInputManifest().getExecPath(), runfilesDir.relativeTo(executor.getExecRoot()), /* filesetTree= */ false) - .createSymlinks(testAction, actionExecutionContext, binTools, shExecutable); + .createSymlinks( + testAction, actionExecutionContext, binTools, shExecutable, shellEnvironment); executor.getEventHandler().handle(Event.progress(testAction.getProgressMessage())); } |