Skip to content

Commit

Permalink
Enable compilation tests using parallel backend
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Mar 28, 2023
1 parent 597e976 commit 6ed7b94
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import scala.concurrent.duration._
import TestSources.sources
import reporting.TestReporter
import vulpix._
import dotty.tools.dotc.config.ScalaSettings

class CompilationTests {
import ParallelTesting._
Expand Down Expand Up @@ -273,7 +274,6 @@ class CompilationTests {
compileFilesInDir("tests/init/neg", options).checkExpectedErrors()
compileFilesInDir("tests/init/pos", options).checkCompile()
compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile()

// The regression test for i12128 has some atypical classpath requirements.
// The test consists of three files: (a) Reflect_1 (b) Macro_2 (c) Test_3
// which must be compiled separately. In addition:
Expand All @@ -295,6 +295,38 @@ class CompilationTests {
tests.foreach(_.delete())
}
}

// parallel backend tests
@Test def parallelBackend: Unit = {
given TestGroup = TestGroup("parallelBackend")
val parallelism = Runtime.getRuntime().availableProcessors().min(16)
assumeTrue("Not enough available processors to run parallel tests", parallelism > 1)

val options = defaultOptions.and(s"-Ybackend-parallelism:${parallelism}")
def parCompileDir(directory: String) = compileDir(directory, options)

// Compilation units containing more than 1 source file
aggregateTests(
parCompileDir("tests/pos/i10477"),
parCompileDir("tests/pos/i4758"),
parCompileDir("tests/pos/scala2traits"),
parCompileDir("tests/pos/class-gadt"),
parCompileDir("tests/pos/tailcall"),
parCompileDir("tests/pos/reference"),
parCompileDir("tests/pos/pos_valueclasses")
).checkCompile()

aggregateTests(
parCompileDir("tests/neg/package-implicit"),
parCompileDir("tests/neg/package-export")
).checkExpectedErrors()

aggregateTests(
parCompileDir("tests/run/decorators"),
parCompileDir("tests/run/generic")
).checkRuns()

}
}

object CompilationTests extends ParallelTesting {
Expand Down

0 comments on commit 6ed7b94

Please sign in to comment.