aboutsummaryrefslogtreecommitdiff
path: root/compiler/test
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-03-20 15:44:46 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-03-29 10:33:25 +0200
commit8c02da6858615dacfbcc09c2431e0945fce6d730 (patch)
tree5a58872b3f9891baf2c0656fe8036021013ef2e0 /compiler/test
parent0df3f618b2540ec0c87d16ef911f2f77bbe1b327 (diff)
downloaddotty-8c02da6858615dacfbcc09c2431e0945fce6d730.tar.gz
dotty-8c02da6858615dacfbcc09c2431e0945fce6d730.tar.bz2
dotty-8c02da6858615dacfbcc09c2431e0945fce6d730.zip
Fix tasty bootstrap
Diffstat (limited to 'compiler/test')
-rw-r--r--compiler/test/dotty/tools/dotc/CompilationTests.scala47
-rw-r--r--compiler/test/dotty/tools/dotc/ParallelTesting.scala31
2 files changed, 52 insertions, 26 deletions
diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala
index 6ce5fe95a..e7ecd342a 100644
--- a/compiler/test/dotty/tools/dotc/CompilationTests.scala
+++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala
@@ -197,23 +197,42 @@ class CompilationTests extends ParallelTesting {
* version of Dotty
*/
@Test def tastyBootstrap: Unit = {
- def dotty1 =
- compileDir("../compiler/src/dotty", allowDeepSubtypes.and("-Ycheck-reentrant", "-strict"))
- def lib =
- compileDir("../library/src", defaultOptions)
- def dotty2 =
- compileDir("../compiler/src/dotty", defaultOptions.and("-priorityclasspath", defaultOutputDir))
+ val opt = Array(
+ "-classpath",
+ // compile with bootstrapped library on cp:
+ defaultOutputDir + "lib$1/src/:" +
+ // as well as bootstrapped compiler:
+ defaultOutputDir + "dotty1$1/dotty/:" +
+ Jars.dottyInterfaces
+ )
- List(dotty1, lib, dotty2).map(_.keepOutput.pos).foreach(_.delete())
- }
+ def lib =
+ compileDir("../library/src",
+ allowDeepSubtypes.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir))
- @Test def dotty = {
- def bootedLib =
- compileDir("../library/src", allowDeepSubtypes.and("-Ycheck-reentrant", "-strict"))
- def dottyDependsOnBootedLib =
- compileDir("../compiler/src/dotty", allowDeepSubtypes.and("-Ycheck-reentrant", "-strict"))
+ def dotty1 =
+ compileDir("../compiler/src/dotty", opt)
- List(bootedLib, dottyDependsOnBootedLib).map(_.keepOutput.pos).foreach(_.delete())
+ def dotty2 =
+ compileShallowFilesInDir("../compiler/src/dotty", opt)
+
+ {
+ lib.keepOutput :: dotty1.keepOutput :: {
+ dotty2 +
+ compileShallowFilesInDir("../compiler/src/dotty/tools", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/ast", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/config", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/parsing", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/printing", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/repl", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/reporting", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/rewrite", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/transform", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/typer", opt) +
+ compileShallowFilesInDir("../compiler/src/dotty/tools/dotc/util", opt)
+ } :: Nil
+ }.map(_.pos()).foreach(_.delete())
}
}
diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
index c9b9a8f64..d89a8940b 100644
--- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala
+++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala
@@ -24,13 +24,16 @@ trait ParallelTesting {
def outDir: JFile
def flags: Array[String]
- def withFlags(newFlags: Array[String]) = self match {
- case self: ConcurrentCompilationTarget =>
- self.copy(flags = newFlags)
- case self: SeparateCompilationTarget =>
- self.copy(flags = newFlags)
- }
+ def withFlags(newFlags: Array[String]) =
+ if (!flags.containsSlice(newFlags)) self match {
+ case self: ConcurrentCompilationTarget =>
+ self.copy(flags = newFlags)
+ case self: SeparateCompilationTarget =>
+ self.copy(flags = newFlags)
+ }
+ else self
}
+
private final case class ConcurrentCompilationTarget(
files: Array[JFile],
flags: Array[String],
@@ -387,8 +390,12 @@ trait ParallelTesting {
}
def addOutDir(xs: Array[String]): Array[String] = {
- val (beforeCp, cp :: cpArg :: rest) = xs.toList.span(_ != "-classpath")
- (beforeCp ++ (cp :: (cpArg + s":${targetDir.getAbsolutePath}") :: rest)).toArray
+ val (beforeCp, cpAndAfter) = xs.toList.span(_ != "-classpath")
+ if (cpAndAfter.nonEmpty) {
+ val (cp :: cpArg :: rest) = cpAndAfter
+ (beforeCp ++ (cp :: (cpArg + s":${targetDir.getAbsolutePath}") :: rest)).toArray
+ }
+ else (beforeCp ++ ("-classpath" :: targetDir.getAbsolutePath :: Nil)).toArray
}
def compileWithJavac(fs: Array[String]) = if (fs.nonEmpty) {
@@ -538,7 +545,7 @@ trait ParallelTesting {
targetDir
}
- private def requirements(f: String, sourceDir: JFile, outDir: String): Unit = {
+ private def checkRequirements(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")
}
@@ -593,7 +600,7 @@ trait ParallelTesting {
def compileDir(f: String, flags: Array[String])(implicit outDirectory: String): CompilationTest = {
val outDir = outDirectory + getCallingMethod + "/"
val sourceDir = new JFile(f)
- requirements(f, sourceDir, outDir)
+ checkRequirements(f, sourceDir, outDir)
def flatten(f: JFile): Array[JFile] =
if (f.isDirectory) f.listFiles.flatMap(flatten)
@@ -624,7 +631,7 @@ trait ParallelTesting {
def compileFilesInDir(f: String, flags: Array[String])(implicit outDirectory: String): CompilationTest = {
val outDir = outDirectory + getCallingMethod + "/"
val sourceDir = new JFile(f)
- requirements(f, sourceDir, outDir)
+ checkRequirements(f, sourceDir, outDir)
val (dirs, files) = compilationTargets(sourceDir)
@@ -639,7 +646,7 @@ trait ParallelTesting {
def compileShallowFilesInDir(f: String, flags: Array[String])(implicit outDirectory: String): CompilationTest = {
val outDir = outDirectory + getCallingMethod + "/"
val sourceDir = new JFile(f)
- requirements(f, sourceDir, outDir)
+ checkRequirements(f, sourceDir, outDir)
val (_, files) = compilationTargets(sourceDir)