From 6419a0668b3d4e0bfd42f9a1f69fde66a3944fd6 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 11 Jan 2017 04:05:49 +0100 Subject: Do not hardcode jars path in the tests, instead get them from sbt This is necessary to run the tests with the bootstrapped projects and is just much better than hardcoding them anyway. --- compiler/test/dotty/Jars.scala | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'compiler/test') diff --git a/compiler/test/dotty/Jars.scala b/compiler/test/dotty/Jars.scala index 6fc9b0fde..f062f8b25 100644 --- a/compiler/test/dotty/Jars.scala +++ b/compiler/test/dotty/Jars.scala @@ -1,20 +1,18 @@ package dotty -/** Jars used when compiling test, defaults to sbt locations */ +/** Jars used when compiling test, normally set from the sbt build */ object Jars { - val dottyLib: String = sys.env.get("DOTTY_LIB") getOrElse { - "../library/target/scala-2.11/dotty-library_2.11-0.1.1-SNAPSHOT.jar" - } + val dottyLib: String = sys.env.get("DOTTY_LIB") + .getOrElse(sys.props("dotty.tests.classes.library")) - val dottyCompiler: String = sys.env.get("DOTTY_COMPILER") getOrElse { - "./target/scala-2.11/dotty-compiler_2.11-0.1.1-SNAPSHOT.jar" - } + val dottyCompiler: String = sys.env.get("DOTTY_COMPILER") + .getOrElse(sys.props("dotty.tests.classes.compiler")) - val dottyInterfaces: String = sys.env.get("DOTTY_INTERFACE") getOrElse { - "../interfaces/target/dotty-interfaces-0.1.1-SNAPSHOT.jar" - } + val dottyInterfaces: String = sys.env.get("DOTTY_INTERFACE") + .getOrElse(sys.props("dotty.tests.classes.interfaces")) - val dottyExtras: List[String] = sys.env.get("DOTTY_EXTRAS") + val dottyExtras: List[String] = Option(sys.env.get("DOTTY_EXTRAS") + .getOrElse(sys.props("dotty.tests.extraclasspath"))) .map(_.split(":").toList).getOrElse(Nil) val dottyReplDeps: List[String] = dottyLib :: dottyExtras -- cgit v1.2.3 From adc370df8a584096467ba567c0b75d7cec36fd81 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 11 Jan 2017 00:57:59 +0100 Subject: Use new sbt-based bootstrap for partest too `partest` and `partest-only` are now run through `dotty-compiler-bootstrapped`. The old bootstrapping mechanism is deleted since it has been unmaintained and broken for several months and that I do not wish to maintain two bootstrapping mechanisms. --- compiler/test/dotc/build.scala | 40 ---------------------------------------- project/Build.scala | 19 ++++++++----------- 2 files changed, 8 insertions(+), 51 deletions(-) delete mode 100644 compiler/test/dotc/build.scala (limited to 'compiler/test') diff --git a/compiler/test/dotc/build.scala b/compiler/test/dotc/build.scala deleted file mode 100644 index b1c8db7c7..000000000 --- a/compiler/test/dotc/build.scala +++ /dev/null @@ -1,40 +0,0 @@ -package dotc - -import java.io.File - -object build extends tests { - - private def deleteFilesInFolder(folder: File, deleteFolder: Boolean = false): Unit = { - val files = folder.listFiles() - if(files != null) { //some JVMs return null for empty dirs - for(f <- files) { - if(f.isDirectory) { - deleteFilesInFolder(f, deleteFolder = true) - } else { - f.delete() - } - } - } - if(deleteFolder) folder.delete() - } - - def clearOutput() = { - deleteFilesInFolder(new File(defaultOutputDir)) // clear previous output - val keepFile = new File(defaultOutputDir + ".keep") - keepFile.createNewFile() - } - - def main(args: Array[String]): Unit = { - println("---------- Building bootstrapped dotty-lib ----------------------------------------------") - clearOutput() - dottyBootedLib - val p1 = Runtime.getRuntime.exec(Array("jar", "cf", "dotty-lib.jar", "-C", "out", ".")) - p1.waitFor() - - println("---------- Building bootstrapped dotty depending on dotty-lib compiled by dotty ----------") - clearOutput() - dottyDependsOnBootedLib - val p2 = Runtime.getRuntime.exec(Array("jar", "cf", "dotty.jar", "-C", "out", ".")) - p2.waitFor() - } -} diff --git a/project/Build.scala b/project/Build.scala index 4c8854267..a24fc5371 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -119,23 +119,20 @@ object DottyBuild extends Build { addCommandAlias("run", "dotty-compiler/run") ++ addCommandAlias( "partest", - ";packageAll" + - ";dotty-compiler/test:runMain dotc.build" + - ";dotty-compiler/lockPartestFile" + - ";dotty-compiler/test:test" + - ";dotty-compiler/runPartestRunner" + ";publishLocal" + // Non-bootstrapped dotty needs to be published first + ";dotty-compiler-bootstrapped/lockPartestFile" + + ";dotty-compiler-bootstrapped/test:test" + + ";dotty-compiler-bootstrapped/runPartestRunner" ) ++ addCommandAlias( "partest-only", - ";packageAll" + - ";dotty-compiler/test:runMain dotc.build" + - ";dotty-compiler/lockPartestFile" + - ";dotty-compiler/test:test-only dotc.tests" + - ";dotty-compiler/runPartestRunner" + ";publishLocal" + // Non-bootstrapped dotty needs to be published first + ";dotty-compiler-bootstrapped/lockPartestFile" + + ";dotty-compiler-bootstrapped/test:test-only dotc.tests" + + ";dotty-compiler-bootstrapped/runPartestRunner" ) ++ addCommandAlias( "partest-only-no-bootstrap", - ";packageAll" + ";dotty-compiler/lockPartestFile" + ";dotty-compiler/test:test-only dotc.tests" + ";dotty-compiler/runPartestRunner" -- cgit v1.2.3 From d71be28057621750f1ccb168f538c6d942935cac Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 29 Nov 2016 20:08:23 +0100 Subject: Fix some dotty compilation errors --- compiler/src/dotty/tools/dotc/parsing/Scanners.scala | 3 ++- compiler/test/dotc/tests.scala | 2 +- compiler/test/dotty/partest/DPConsoleRunner.scala | 9 +++++++-- .../test/dotty/tools/dotc/parsing/ModifiersParsingTest.scala | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'compiler/test') diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 101be167e..b75169792 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -567,7 +567,8 @@ object Scanners { nextChar() getOperatorRest() } else { - error(f"illegal character '\\u${ch: Int}%04x'") + // FIXME: Dotty deviation: f"" interpolator is not supported (#1814) + error("illegal character '\\u%04x'".format(ch: Int)) nextChar() } } diff --git a/compiler/test/dotc/tests.scala b/compiler/test/dotc/tests.scala index 608132bca..6ef6bb741 100644 --- a/compiler/test/dotc/tests.scala +++ b/compiler/test/dotc/tests.scala @@ -61,7 +61,7 @@ class tests extends CompilerTest { List("-classpath", paths) } - implicit val defaultOptions = noCheckOptions ++ { + implicit val defaultOptions: List[String] = noCheckOptions ++ { if (isRunByJenkins) List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef") // should be Ycheck:all, but #725 else List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef") } ++ checkOptions ++ classPath diff --git a/compiler/test/dotty/partest/DPConsoleRunner.scala b/compiler/test/dotty/partest/DPConsoleRunner.scala index f418d2c37..0ad573792 100644 --- a/compiler/test/dotty/partest/DPConsoleRunner.scala +++ b/compiler/test/dotty/partest/DPConsoleRunner.scala @@ -202,7 +202,7 @@ class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runn import FileManager.joinPaths // compile using command-line javac compiler val args = Seq( - javacCmdPath, + suiteRunner.javacCmdPath, // FIXME: Dotty deviation just writing "javacCmdPath" doesn't work "-d", outDir.getAbsolutePath, "-classpath", @@ -398,8 +398,13 @@ class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runn override def extraClasspath = suiteRunner.fileManager.asInstanceOf[DottyFileManager].extraJarList ::: super.extraClasspath + + // FIXME: Dotty deviation: error if return type is omitted: + // overriding method cleanup in class Runner of type ()Unit; + // method cleanup of type => Boolean | Unit has incompatible type + // override to keep class files if failed and delete clog if ok - override def cleanup = if (lastState.isOk) { + override def cleanup: Unit = if (lastState.isOk) { logFile.delete cLogFile.delete Directory(outDir).deleteRecursively diff --git a/compiler/test/dotty/tools/dotc/parsing/ModifiersParsingTest.scala b/compiler/test/dotty/tools/dotc/parsing/ModifiersParsingTest.scala index 32f842e92..806e1af46 100644 --- a/compiler/test/dotty/tools/dotc/parsing/ModifiersParsingTest.scala +++ b/compiler/test/dotty/tools/dotc/parsing/ModifiersParsingTest.scala @@ -10,11 +10,11 @@ import ast.untpd._ import ast.{ Trees => d } import Parsers.Parser import util.SourceFile -import core.Contexts.ContextBase +import core.Contexts._ import core.Flags object ModifiersParsingTest { - implicit val ctx = (new ContextBase).initialCtx + implicit val ctx: Context = (new ContextBase).initialCtx implicit def parse(code: String): Tree = { val (_, stats) = new Parser(new SourceFile("", code.toCharArray)).templateStatSeq() -- cgit v1.2.3 From 779c96bef04d81048f91135b386bd7f37fcf1f20 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sun, 27 Nov 2016 17:19:57 +0100 Subject: Fix bug in partest.DPConsoleRunner The bug was that we declared case classes like: case class CompFailed() extends NegTestState but we used their companion objects like in: case _ => CompFailed Interestingly, this bug was caught by compiling this code with dotty, instead of `failureStates` getting inferred to be of type `AnyRef`, it ended up being a union of object types, this allows dotty to realize our subsequent pattern match on `failureStates` cannot possibly succeed: -- Error: /home/smarter/opt/dotty/compiler/test/dotty/partest/DPConsoleRunner.scala 353 | case CompFailedButWrongDiff() => | ^ | missing parameter type for parameter x$1 of expanded function x$1 => | x$1 @unchecked match | { | case CompFailedButWrongDiff() => | nextTestActionFailing(s"output differs") | true | case _ => | false | }, expected = ? -- Error: /home/smarter/opt/dotty/compiler/test/dotty/partest/DPConsoleRunner.scala 353 | case CompFailedButWrongDiff() => | ^^^^^^^^^^^^^^^^^^^^^^^^ |Pattern type CompFailedButWrongDiff is neither a subtype nor a supertype of selector type CompSucceeded | CompFailedButWrongNErr | CompFailed | CompFailedButWrongDiff'where: CompFailedButWrongDiff is a class in method runNegTest | CompFailedButWrongDiff' is a object in method runNegTest --- compiler/test/dotty/partest/DPConsoleRunner.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/test') diff --git a/compiler/test/dotty/partest/DPConsoleRunner.scala b/compiler/test/dotty/partest/DPConsoleRunner.scala index 0ad573792..7a25af6b7 100644 --- a/compiler/test/dotty/partest/DPConsoleRunner.scala +++ b/compiler/test/dotty/partest/DPConsoleRunner.scala @@ -300,11 +300,11 @@ class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runn // Don't get confused, the neg test passes when compilation fails for at // least one round (optionally checking the number of compiler errors and // compiler console output) - case class CompFailed() extends NegTestState + case object CompFailed extends NegTestState // the neg test fails when all rounds return either of these: case class CompFailedButWrongNErr(expected: String, found: String) extends NegTestState - case class CompFailedButWrongDiff() extends NegTestState - case class CompSucceeded() extends NegTestState + case object CompFailedButWrongDiff extends NegTestState + case object CompSucceeded extends NegTestState def nerrIsOk(reason: String) = { val nerrFinder = """compilation failed with (\d+) errors""".r @@ -350,7 +350,7 @@ class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runn if (existsNerr) false else { val existsDiff = failureStates.exists({ - case CompFailedButWrongDiff() => + case CompFailedButWrongDiff => nextTestActionFailing(s"output differs") true case _ => -- cgit v1.2.3