aboutsummaryrefslogtreecommitdiff
path: root/compiler/test
diff options
context:
space:
mode:
authorOlivier Blanvillain <olivier.blanvillain@gmail.com>2017-04-06 10:56:14 +0200
committerOlivier Blanvillain <olivier.blanvillain@gmail.com>2017-04-06 11:12:37 +0200
commit8a83bb1f865bdc79cc716034199bc9d350d4f055 (patch)
tree9585d1365c5d979f6c995192b921ee8ad1b08bcb /compiler/test
parentf693ba744124940e3dc5ebfbf0f0c248c61a84d0 (diff)
downloaddotty-8a83bb1f865bdc79cc716034199bc9d350d4f055.tar.gz
dotty-8a83bb1f865bdc79cc716034199bc9d350d4f055.tar.bz2
dotty-8a83bb1f865bdc79cc716034199bc9d350d4f055.zip
Use alphabetic sort by default
Diffstat (limited to 'compiler/test')
-rw-r--r--compiler/test/dotty/tools/dotc/ParallelTesting.scala15
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
index e5068dcd0..45de03b48 100644
--- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala
+++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
@@ -1011,8 +1011,11 @@ trait ParallelTesting { self =>
/** Compiles a directory `f` using the supplied `flags`. This method does
* deep compilation, that is - it compiles all files and subdirectories
* contained within the directory `f`.
+ *
+ * By default, files are compiled in alphabetical order. An optional seed
+ * can be used for randomization.
*/
- def compileDir(f: String, flags: Array[String], seed: Int = 42)(implicit outDirectory: String): CompilationTest = {
+ def compileDir(f: String, flags: Array[String], randomOrder: Option[Int] = None)(implicit outDirectory: String): CompilationTest = {
val callingMethod = getCallingMethod
val outDir = outDirectory + callingMethod + "/"
val sourceDir = new JFile(f)
@@ -1022,14 +1025,18 @@ trait ParallelTesting { self =>
if (f.isDirectory) f.listFiles.flatMap(flatten)
else Array(f)
- // Deterministically randomises compilation order
- val files = new Random(seed).shuffle(flatten(sourceDir).toList).toArray
+ // Sort files either alphabetically or randomly using the provided seed:
+ val sortedFiles = flatten(sourceDir).sorted
+ val randomized = randomOrder match {
+ case None => sortedFiles
+ case Some(seed) => new Random(seed).shuffle(sortedFiles.toList).toArray
+ }
// Directories in which to compile all containing files with `flags`:
val targetDir = new JFile(outDir + "/" + sourceDir.getName + "/")
targetDir.mkdirs()
- val target = JointCompilationSource(callingMethod, files, flags, targetDir)
+ val target = JointCompilationSource(callingMethod, randomized, flags, targetDir)
new CompilationTest(target)
}