Skip to content

Commit

Permalink
Description redacted.
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=137935119
  • Loading branch information
hermione521 authored and laszlocsomor committed Nov 2, 2016
1 parent ca2c184 commit 247ce2c
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.devtools.build.lib.util.io.FileWatcher;
import com.google.devtools.build.lib.util.io.OutErr;
import com.google.devtools.build.lib.vfs.FileStatus;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.SearchPath;
Expand Down Expand Up @@ -66,6 +67,27 @@ protected static boolean isCoverageMode(TestRunnerAction action) {
return action.getCoverageData() != null;
}

/**
* Ensures that all directories used to run test are in the correct state and
* their content will not result in stale files.
*/
protected void prepareFileSystem(TestRunnerAction testAction, Path tmpDir,
Path coverageDir, Path workingDirectory) throws IOException {
if (isCoverageMode(testAction)) {
recreateDirectory(coverageDir);
}
recreateDirectory(tmpDir);
FileSystemUtils.createDirectoryAndParents(workingDirectory);
}

/**
* Removes directory if it exists and recreates it.
*/
protected void recreateDirectory(Path directory) throws IOException {
FileSystemUtils.deleteTree(directory);
FileSystemUtils.createDirectoryAndParents(directory);
}

/**
* Converter for the --flaky_test_attempts option.
*/
Expand Down

0 comments on commit 247ce2c

Please sign in to comment.