aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/ParallelTesting.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-03-20 15:44:10 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-03-29 10:33:25 +0200
commit0df3f618b2540ec0c87d16ef911f2f77bbe1b327 (patch)
treeac359d94bdf1954fcc564af0846475f73890658d /compiler/test/dotty/tools/dotc/ParallelTesting.scala
parentd2e50d92be4038bf0ec07a61caff7959b8f2a583 (diff)
downloaddotty-0df3f618b2540ec0c87d16ef911f2f77bbe1b327.tar.gz
dotty-0df3f618b2540ec0c87d16ef911f2f77bbe1b327.tar.bz2
dotty-0df3f618b2540ec0c87d16ef911f2f77bbe1b327.zip
Support copyToDir for tests that mutate original source
Diffstat (limited to 'compiler/test/dotty/tools/dotc/ParallelTesting.scala')
-rw-r--r--compiler/test/dotty/tools/dotc/ParallelTesting.scala23
1 files changed, 17 insertions, 6 deletions
diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
index 0cb6e8d7c..c9b9a8f64 100644
--- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala
+++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
@@ -479,6 +479,23 @@ trait ParallelTesting {
this
}
+ private def copyToDir(dir: JFile, file: JFile): JFile = {
+ val target = Paths.get(dir.getAbsolutePath, file.getName)
+ Files.copy(file.toPath, target, REPLACE_EXISTING)
+ if (file.isDirectory) file.listFiles.map(copyToDir(target.toFile, _))
+ target.toFile
+ }
+
+ def copyToTarget(): CompilationTest = new CompilationTest (
+ targets.map {
+ case target @ ConcurrentCompilationTarget(files, _, outDir) =>
+ target.copy(files = files.map(copyToDir(outDir,_)))
+ case target @ SeparateCompilationTarget(dir, _, outDir) =>
+ target.copy(dir = copyToDir(outDir, dir))
+ },
+ times, shouldDelete, threadLimit
+ )
+
def times(i: Int): CompilationTest =
new CompilationTest(targets, i, shouldDelete, threadLimit)
@@ -521,12 +538,6 @@ trait ParallelTesting {
targetDir
}
- private def copyToDir(dir: JFile, file: JFile): Unit = {
- val target = Paths.get(dir.getAbsolutePath, file.getName)
- Files.copy(file.toPath, target, REPLACE_EXISTING)
- if (file.isDirectory) file.listFiles.map(copyToDir(target.toFile, _))
- }
-
private def requirements(f: String, sourceDir: JFile, outDir: String): Unit = {
require(sourceDir.isDirectory && sourceDir.exists, "passed non-directory to `compileFilesInDir`")
require(outDir.last == '/', "please specify an `outDir` with a trailing slash")