From 2664fe311e7e38a3d3e1c496ccfb90be884b7f7c Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 25 Sep 2017 13:53:08 +0200 Subject: [PATCH 1/3] Revert "Revert "Add regression tests on optimise"" This reverts commit 1943f4e4985ebd1d9bbd5f06418fef0f2b79dd21. --- compiler/test/dotty/tools/dotc/CompilationTests.scala | 4 ++++ tests/neg/{ => no-optimise}/patmat.scala | 0 tests/neg/{ => no-optimise}/tryPatternMatchError.scala | 0 3 files changed, 4 insertions(+) rename tests/neg/{ => no-optimise}/patmat.scala (100%) rename tests/neg/{ => no-optimise}/tryPatternMatchError.scala (100%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 2863bff4e48d..dd7af3d14186 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -91,6 +91,7 @@ class CompilationTests extends ParallelTesting { compileFilesInDir("../tests/new", defaultOptions) + compileFilesInDir("../tests/pos-scala2", scala2Mode) + compileFilesInDir("../tests/pos", defaultOptions) + + compileFilesInDir("../tests/pos", defaultOptimised) + compileFilesInDir("../tests/pos-deep-subtype", allowDeepSubtypes) + compileFile( // succeeds despite -Xfatal-warnings because of -nowarn @@ -159,6 +160,8 @@ class CompilationTests extends ParallelTesting { @Test def compileNeg: Unit = { compileShallowFilesInDir("../tests/neg", defaultOptions) + + compileShallowFilesInDir("../tests/neg/no-optimise", defaultOptions) + + compileShallowFilesInDir("../tests/neg", defaultOptimised) + compileFile("../tests/neg/customArgs/typers.scala", allowDoubleBindings) + compileFile("../tests/neg/customArgs/overrideClass.scala", scala2Mode) + compileFile("../tests/neg/customArgs/autoTuplingTest.scala", defaultOptions.and("-language:noAutoTupling")) + @@ -186,6 +189,7 @@ class CompilationTests extends ParallelTesting { @Test def runAll: Unit = { compileFilesInDir("../tests/run", defaultOptions) + + compileFilesInDir("../tests/run", defaultOptimised) + compileFile("../tests/run/i3018.scala", defaultOptimised) + compileFile("../tests/run/blame_eye_triple_eee-double.scala", defaultOptimised) + compileFile("../tests/run/blame_eye_triple_eee-float.scala", defaultOptimised) + diff --git a/tests/neg/patmat.scala b/tests/neg/no-optimise/patmat.scala similarity index 100% rename from tests/neg/patmat.scala rename to tests/neg/no-optimise/patmat.scala diff --git a/tests/neg/tryPatternMatchError.scala b/tests/neg/no-optimise/tryPatternMatchError.scala similarity index 100% rename from tests/neg/tryPatternMatchError.scala rename to tests/neg/no-optimise/tryPatternMatchError.scala From e35a7be039bb00686e580cba6974566b548e67ea Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 25 Sep 2017 15:16:14 +0200 Subject: [PATCH 2/3] Re-encode vulpix implicit output directory --- compiler/test/dotc/comptest.scala | 5 ++--- .../test/dotty/tools/dotc/CompilationTests.scala | 1 + .../test/dotty/tools/dotc/LinkOptimiseTests.scala | 1 + .../test/dotty/tools/vulpix/ParallelTesting.scala | 13 ++++++++----- .../test/dotty/tools/vulpix/TestConfiguration.scala | 1 - 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/compiler/test/dotc/comptest.scala b/compiler/test/dotc/comptest.scala index 318f9cd80612..de9fb0b1e515 100644 --- a/compiler/test/dotc/comptest.scala +++ b/compiler/test/dotc/comptest.scala @@ -12,8 +12,6 @@ object comptest extends ParallelTesting { def isInteractive = true def testFilter = None - implicit val defaultOutputDir: String = "." - val posDir = "./tests/pos/" val negDir = "./tests/neg/" val dotcDir = "./src/dotty/" @@ -26,6 +24,7 @@ object comptest extends ParallelTesting { dotcDir + "tools/dotc/core/Types.scala", dotcDir + "tools/dotc/ast/Trees.scala" ), - TestFlags("", Array("-Ylog:frontend", "-Xprompt")) + TestFlags("", Array("-Ylog:frontend", "-Xprompt")), + outDirectory = "." ) } diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index dd7af3d14186..a55a5e88a9c2 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -15,6 +15,7 @@ import dotty.tools.io.JFile class CompilationTests extends ParallelTesting { + import ParallelTesting._ import TestConfiguration._ import CompilationTests._ diff --git a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala index 70fa01c5f053..7aa2f0bcb651 100644 --- a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala +++ b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala @@ -13,6 +13,7 @@ import scala.concurrent.duration._ import scala.collection.JavaConverters._ class LinkOptimiseTests extends ParallelTesting { + import ParallelTesting._ import TestConfiguration._ import LinkOptimiseTests._ diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index b5534337e82b..2fad926c0a79 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -1057,7 +1057,7 @@ trait ParallelTesting extends RunnerOrchestration { self => } /** Compiles a single file from the string path `f` using the supplied flags */ - def compileFile(f: String, flags: TestFlags)(implicit outDirectory: String): CompilationTest = { + def compileFile(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = { val callingMethod = getCallingMethod() val sourceFile = new JFile(f) val parent = sourceFile.getParentFile @@ -1087,7 +1087,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * By default, files are compiled in alphabetical order. An optional seed * can be used for randomization. */ - def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None)(implicit outDirectory: String): CompilationTest = { + def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, outDirectory: String = defaultOutputDir): CompilationTest = { val callingMethod = getCallingMethod() val outDir = outDirectory + callingMethod + "/" val sourceDir = new JFile(f) @@ -1116,7 +1116,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * `testName` since files can be in separate directories and or be otherwise * dissociated */ - def compileList(testName: String, files: List[String], flags: TestFlags, callingMethod: String = getCallingMethod())(implicit outDirectory: String): CompilationTest = { + def compileList(testName: String, files: List[String], flags: TestFlags, callingMethod: String = getCallingMethod(), outDirectory: String = defaultOutputDir): CompilationTest = { val outDir = outDirectory + callingMethod + "/" + testName + "/" // Directories in which to compile all containing files with `flags`: @@ -1147,7 +1147,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * - Directories can have an associated check-file, where the check file has * the same name as the directory (with the file extension `.check`) */ - def compileFilesInDir(f: String, flags: TestFlags)(implicit outDirectory: String): CompilationTest = { + def compileFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = { val callingMethod = getCallingMethod() val outDir = outDirectory + callingMethod + "/" val sourceDir = new JFile(f) @@ -1167,7 +1167,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * sub-directories and as such, does **not** perform separate compilation * tests. */ - def compileShallowFilesInDir(f: String, flags: TestFlags)(implicit outDirectory: String): CompilationTest = { + def compileShallowFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = { val callingMethod = getCallingMethod() val outDir = outDirectory + callingMethod + "/" val sourceDir = new JFile(f) @@ -1185,6 +1185,9 @@ trait ParallelTesting extends RunnerOrchestration { self => } object ParallelTesting { + + def defaultOutputDir: String = "../out/" + def isSourceFile(f: JFile): Boolean = { val name = f.getName name.endsWith(".scala") || name.endsWith(".java") diff --git a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala index 1c94ba230a10..9ebd7a6cae91 100644 --- a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala +++ b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala @@ -3,7 +3,6 @@ package tools package vulpix object TestConfiguration { - implicit val defaultOutputDir: String = "../out/" val noCheckOptions = Array( "-pagewidth", "120", From 2caa7bad07e92e9c671ebc971bb9b4dd805c5f09 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 25 Sep 2017 15:47:48 +0200 Subject: [PATCH 3/3] Fix output paths for optimised tests --- .../dotty/tools/dotc/CompilationTests.scala | 18 ++++++++---------- tests/{run => run-no-optimise}/2772.scala | 0 2 files changed, 8 insertions(+), 10 deletions(-) rename tests/{run => run-no-optimise}/2772.scala (100%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index a55a5e88a9c2..3eba2b1e7e8a 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -69,7 +69,6 @@ class CompilationTests extends ParallelTesting { compileFilesInDir("../tests/pos-special/strawman-collections", defaultOptions) + compileFile("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala", defaultOptions) + compileFile("../scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala", defaultOptions) + - compileFile("../tests/pos/t2171.scala", defaultOptimised) + compileList( "parSetSubset", List( @@ -92,7 +91,6 @@ class CompilationTests extends ParallelTesting { compileFilesInDir("../tests/new", defaultOptions) + compileFilesInDir("../tests/pos-scala2", scala2Mode) + compileFilesInDir("../tests/pos", defaultOptions) + - compileFilesInDir("../tests/pos", defaultOptimised) + compileFilesInDir("../tests/pos-deep-subtype", allowDeepSubtypes) + compileFile( // succeeds despite -Xfatal-warnings because of -nowarn @@ -162,7 +160,6 @@ class CompilationTests extends ParallelTesting { @Test def compileNeg: Unit = { compileShallowFilesInDir("../tests/neg", defaultOptions) + compileShallowFilesInDir("../tests/neg/no-optimise", defaultOptions) + - compileShallowFilesInDir("../tests/neg", defaultOptimised) + compileFile("../tests/neg/customArgs/typers.scala", allowDoubleBindings) + compileFile("../tests/neg/customArgs/overrideClass.scala", scala2Mode) + compileFile("../tests/neg/customArgs/autoTuplingTest.scala", defaultOptions.and("-language:noAutoTupling")) + @@ -190,13 +187,7 @@ class CompilationTests extends ParallelTesting { @Test def runAll: Unit = { compileFilesInDir("../tests/run", defaultOptions) + - compileFilesInDir("../tests/run", defaultOptimised) + - compileFile("../tests/run/i3018.scala", defaultOptimised) + - compileFile("../tests/run/blame_eye_triple_eee-double.scala", defaultOptimised) + - compileFile("../tests/run/blame_eye_triple_eee-float.scala", defaultOptimised) + - compileFile("../tests/run/run-bug4840.scala", defaultOptimised) + - compileFile("../tests/run/optimizer-array-load.scala", defaultOptimised) + - compileFile("../tests/run/constant-optimization.scala", defaultOptimised) + compileFilesInDir("../tests/run-no-optimise", defaultOptions) }.checkRuns() // Pickling Tests ------------------------------------------------------------ @@ -303,6 +294,13 @@ class CompilationTests extends ParallelTesting { tests.foreach(_.delete()) } + @Test def testOptimised: Unit = { + val outputDir = defaultOutputDir + "optimised/" + compileFilesInDir("../tests/pos", defaultOptimised, outputDir).checkCompile() + compileFilesInDir("../tests/run", defaultOptimised, outputDir).checkRuns() + compileShallowFilesInDir("../tests/neg", defaultOptimised, outputDir).checkExpectedErrors() + } + private val (compilerSources, backendSources, backendJvmSources) = { val compilerDir = Paths.get("../compiler/src") val compilerSources0 = sources(Files.walk(compilerDir)) diff --git a/tests/run/2772.scala b/tests/run-no-optimise/2772.scala similarity index 100% rename from tests/run/2772.scala rename to tests/run-no-optimise/2772.scala