Skip to content

Commit 90cfa03

Browse files
committed
Setup parallel backend compilation tests
1 parent 9f4c28a commit 90cfa03

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import scala.util.matching.Regex
1717
import scala.concurrent.duration._
1818
import TestSources.sources
1919
import vulpix._
20+
import dotty.tools.dotc.config.ScalaSettings
2021

2122
class CompilationTests {
2223
import ParallelTesting._
@@ -265,7 +266,6 @@ class CompilationTests {
265266
compileFilesInDir("tests/init/neg", options).checkExpectedErrors()
266267
compileFilesInDir("tests/init/pos", options).checkCompile()
267268
compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile()
268-
269269
// The regression test for i12128 has some atypical classpath requirements.
270270
// The test consists of three files: (a) Reflect_1 (b) Macro_2 (c) Test_3
271271
// which must be compiled separately. In addition:
@@ -287,6 +287,38 @@ class CompilationTests {
287287
tests.foreach(_.delete())
288288
}
289289
}
290+
291+
// parallel backend tests
292+
@Test def parallelBackend: Unit = {
293+
given TestGroup = TestGroup("parallelBackend")
294+
val parallelism = Runtime.getRuntime().availableProcessors().min(16)
295+
assumeTrue("Not enough available processors to run parallel tests", parallelism > 1)
296+
297+
val options = defaultOptions.and(s"-Ybackend-parallelism:${parallelism}")
298+
def parCompileDir(directory: String) = compileDir(directory, options)
299+
300+
// Compilation units containing more then 1 source file
301+
aggregateTests(
302+
parCompileDir("tests/pos/i10477"),
303+
parCompileDir("tests/pos/i4758"),
304+
parCompileDir("tests/pos/scala2traits"),
305+
parCompileDir("tests/pos/class-gadt"),
306+
parCompileDir("tests/pos/tailcall"),
307+
parCompileDir("tests/pos/reference"),
308+
parCompileDir("tests/pos/pos_valueclasses")
309+
).checkCompile()
310+
311+
aggregateTests(
312+
parCompileDir("tests/neg/package-implicit"),
313+
parCompileDir("tests/neg/package-export")
314+
).checkExpectedErrors()
315+
316+
aggregateTests(
317+
parCompileDir("tests/run/decorators"),
318+
parCompileDir("tests/run/generic")
319+
).checkRuns()
320+
321+
}
290322
}
291323

292324
object CompilationTests extends ParallelTesting {

0 commit comments

Comments
 (0)