diff options
author | 2017-04-20 20:02:09 +0200 | |
---|---|---|
committer | 2017-04-24 16:49:24 +0200 | |
commit | d73a88bb87db1aba2f91920c74dbc7f0409438bb (patch) | |
tree | eefcf4097c58877bc045477ec584013528d39c07 /src/main/java/com/google | |
parent | bea9c01592a5a004c0d6665c10434b44703c1e19 (diff) |
Make the test tmp directory name deterministic
Fixes #2853.
PiperOrigin-RevId: 153730500
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java | 5 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java | 9 |
2 files changed, 13 insertions, 1 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 e74de60aa3..7675da16eb 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 @@ -100,7 +100,10 @@ public class StandaloneTestStrategy extends TestStrategy { action.isEnableRunfiles()); Path tmpDir = tmpDirRoot.getChild( - getTmpDirName(action.getExecutionSettings().getExecutable().getExecPath())); + getTmpDirName( + action.getExecutionSettings().getExecutable().getExecPath(), + action.getShardNum(), + action.getRunNumber())); Map<String, String> env = setupEnvironment(action, execRoot, runfilesDir, tmpDir); Path workingDirectory = runfilesDir.getRelative(action.getRunfilesPrefix()); diff --git a/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java index 0a29b9f89d..7d98a9a942 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java @@ -32,6 +32,7 @@ import com.google.devtools.build.lib.rules.test.TestActionContext; import com.google.devtools.build.lib.rules.test.TestResult; import com.google.devtools.build.lib.rules.test.TestRunnerAction; import com.google.devtools.build.lib.rules.test.TestTargetExecutionSettings; +import com.google.devtools.build.lib.util.Fingerprint; import com.google.devtools.build.lib.util.OS; import com.google.devtools.build.lib.util.io.FileWatcher; import com.google.devtools.build.lib.util.io.OutErr; @@ -262,6 +263,14 @@ public abstract class TestStrategy implements TestActionContext { } } + protected String getTmpDirName(PathFragment execPath, int shard, int run) { + Fingerprint digest = new Fingerprint(); + digest.addPath(execPath); + digest.addInt(shard); + digest.addInt(run); + return digest.hexDigestAndReset(); + } + /** Parse a test result XML file into a {@link TestCase}. */ @Nullable protected TestCase parseTestResult(Path resultFile) { |