Skip to content

Commit 3e95734

Browse files
Merge pull request #3164 from dotty-staging/enable-tests-on-optimise-3
Revert "Revert "Add regression tests on optimise""
2 parents 9e900ca + 2caa7ba commit 3e95734

File tree

8 files changed

+21
-16
lines changed

8 files changed

+21
-16
lines changed

compiler/test/dotc/comptest.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ object comptest extends ParallelTesting {
1212
def isInteractive = true
1313
def testFilter = None
1414

15-
implicit val defaultOutputDir: String = "."
16-
1715
val posDir = "./tests/pos/"
1816
val negDir = "./tests/neg/"
1917
val dotcDir = "./src/dotty/"
@@ -26,6 +24,7 @@ object comptest extends ParallelTesting {
2624
dotcDir + "tools/dotc/core/Types.scala",
2725
dotcDir + "tools/dotc/ast/Trees.scala"
2826
),
29-
TestFlags("", Array("-Ylog:frontend", "-Xprompt"))
27+
TestFlags("", Array("-Ylog:frontend", "-Xprompt")),
28+
outDirectory = "."
3029
)
3130
}

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import dotty.tools.io.JFile
1515

1616

1717
class CompilationTests extends ParallelTesting {
18+
import ParallelTesting._
1819
import TestConfiguration._
1920
import CompilationTests._
2021

@@ -68,7 +69,6 @@ class CompilationTests extends ParallelTesting {
6869
compileFilesInDir("../tests/pos-special/strawman-collections", defaultOptions) +
6970
compileFile("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala", defaultOptions) +
7071
compileFile("../scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala", defaultOptions) +
71-
compileFile("../tests/pos/t2171.scala", defaultOptimised) +
7272
compileList(
7373
"parSetSubset",
7474
List(
@@ -159,6 +159,7 @@ class CompilationTests extends ParallelTesting {
159159

160160
@Test def compileNeg: Unit = {
161161
compileShallowFilesInDir("../tests/neg", defaultOptions) +
162+
compileShallowFilesInDir("../tests/neg/no-optimise", defaultOptions) +
162163
compileFile("../tests/neg/customArgs/typers.scala", allowDoubleBindings) +
163164
compileFile("../tests/neg/customArgs/overrideClass.scala", scala2Mode) +
164165
compileFile("../tests/neg/customArgs/autoTuplingTest.scala", defaultOptions.and("-language:noAutoTupling")) +
@@ -186,12 +187,7 @@ class CompilationTests extends ParallelTesting {
186187

187188
@Test def runAll: Unit = {
188189
compileFilesInDir("../tests/run", defaultOptions) +
189-
compileFile("../tests/run/i3018.scala", defaultOptimised) +
190-
compileFile("../tests/run/blame_eye_triple_eee-double.scala", defaultOptimised) +
191-
compileFile("../tests/run/blame_eye_triple_eee-float.scala", defaultOptimised) +
192-
compileFile("../tests/run/run-bug4840.scala", defaultOptimised) +
193-
compileFile("../tests/run/optimizer-array-load.scala", defaultOptimised) +
194-
compileFile("../tests/run/constant-optimization.scala", defaultOptimised)
190+
compileFilesInDir("../tests/run-no-optimise", defaultOptions)
195191
}.checkRuns()
196192

197193
// Pickling Tests ------------------------------------------------------------
@@ -298,6 +294,13 @@ class CompilationTests extends ParallelTesting {
298294
tests.foreach(_.delete())
299295
}
300296

297+
@Test def testOptimised: Unit = {
298+
val outputDir = defaultOutputDir + "optimised/"
299+
compileFilesInDir("../tests/pos", defaultOptimised, outputDir).checkCompile()
300+
compileFilesInDir("../tests/run", defaultOptimised, outputDir).checkRuns()
301+
compileShallowFilesInDir("../tests/neg", defaultOptimised, outputDir).checkExpectedErrors()
302+
}
303+
301304
private val (compilerSources, backendSources, backendJvmSources) = {
302305
val compilerDir = Paths.get("../compiler/src")
303306
val compilerSources0 = sources(Files.walk(compilerDir))

compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import scala.concurrent.duration._
1313
import scala.collection.JavaConverters._
1414

1515
class LinkOptimiseTests extends ParallelTesting {
16+
import ParallelTesting._
1617
import TestConfiguration._
1718
import LinkOptimiseTests._
1819

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10571057
}
10581058

10591059
/** Compiles a single file from the string path `f` using the supplied flags */
1060-
def compileFile(f: String, flags: TestFlags)(implicit outDirectory: String): CompilationTest = {
1060+
def compileFile(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = {
10611061
val callingMethod = getCallingMethod()
10621062
val sourceFile = new JFile(f)
10631063
val parent = sourceFile.getParentFile
@@ -1087,7 +1087,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10871087
* By default, files are compiled in alphabetical order. An optional seed
10881088
* can be used for randomization.
10891089
*/
1090-
def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None)(implicit outDirectory: String): CompilationTest = {
1090+
def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, outDirectory: String = defaultOutputDir): CompilationTest = {
10911091
val callingMethod = getCallingMethod()
10921092
val outDir = outDirectory + callingMethod + "/"
10931093
val sourceDir = new JFile(f)
@@ -1116,7 +1116,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11161116
* `testName` since files can be in separate directories and or be otherwise
11171117
* dissociated
11181118
*/
1119-
def compileList(testName: String, files: List[String], flags: TestFlags, callingMethod: String = getCallingMethod())(implicit outDirectory: String): CompilationTest = {
1119+
def compileList(testName: String, files: List[String], flags: TestFlags, callingMethod: String = getCallingMethod(), outDirectory: String = defaultOutputDir): CompilationTest = {
11201120
val outDir = outDirectory + callingMethod + "/" + testName + "/"
11211121

11221122
// Directories in which to compile all containing files with `flags`:
@@ -1147,7 +1147,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11471147
* - Directories can have an associated check-file, where the check file has
11481148
* the same name as the directory (with the file extension `.check`)
11491149
*/
1150-
def compileFilesInDir(f: String, flags: TestFlags)(implicit outDirectory: String): CompilationTest = {
1150+
def compileFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = {
11511151
val callingMethod = getCallingMethod()
11521152
val outDir = outDirectory + callingMethod + "/"
11531153
val sourceDir = new JFile(f)
@@ -1167,7 +1167,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11671167
* sub-directories and as such, does **not** perform separate compilation
11681168
* tests.
11691169
*/
1170-
def compileShallowFilesInDir(f: String, flags: TestFlags)(implicit outDirectory: String): CompilationTest = {
1170+
def compileShallowFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = {
11711171
val callingMethod = getCallingMethod()
11721172
val outDir = outDirectory + callingMethod + "/"
11731173
val sourceDir = new JFile(f)
@@ -1185,6 +1185,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11851185
}
11861186

11871187
object ParallelTesting {
1188+
1189+
def defaultOutputDir: String = "../out/"
1190+
11881191
def isSourceFile(f: JFile): Boolean = {
11891192
val name = f.getName
11901193
name.endsWith(".scala") || name.endsWith(".java")

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package tools
33
package vulpix
44

55
object TestConfiguration {
6-
implicit val defaultOutputDir: String = "../out/"
76

87
val noCheckOptions = Array(
98
"-pagewidth", "120",
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)