diff options
author | lberki <lberki@google.com> | 2018-04-06 05:28:35 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-06 05:29:44 -0700 |
commit | ece8c4ede0b6d3ba9cb41a54233fd4343d14e0e7 (patch) | |
tree | f7e890c751d38c6dda1745d83f616a7c6b1e596b /src/main/java | |
parent | aa3d37688f17435174156827a4beb4e1e5b0678a (diff) |
Prepare the file system before executing tests with --direct_run.
RELNOTES: None.
PiperOrigin-RevId: 191876954
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java index 37ed1f8d9e..8aa3566041 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java @@ -465,6 +465,11 @@ public class RunCommand implements BlazeCommand { settings.getRunfilesDir().relativeTo(env.getExecRoot()), relativeTmpDir.getRelative(TestStrategy.getTmpDirName(testAction)))); workingDir = env.getExecRoot(); + + if (!prepareTestEnvironment(env, testAction)) { + return BlazeCommandResult.exitCode(ExitCode.LOCAL_ENVIRONMENTAL_ERROR); + } + try { cmdLine.addAll(TestStrategy.getArgs(testAction)); cmdLine.addAll(commandLineArgs); @@ -514,6 +519,16 @@ public class RunCommand implements BlazeCommand { return BlazeCommandResult.execute(execDescription.build()); } + private boolean prepareTestEnvironment(CommandEnvironment env, TestRunnerAction action) { + try { + action.prepare(env.getRuntime().getFileSystem(), env.getExecRoot()); + return true; + } catch (IOException e) { + env.getReporter().handle(Event.error("Error while setting up test: " + e.getMessage())); + return false; + } + } + /** * Ensures that runfiles are built for the specified target. If they already * are, does nothing, otherwise builds them. |