Skip to content

Commit a07d0c9

Browse files
committed
Setup parallel backend compilation tests
1 parent 6ca8210 commit a07d0c9

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

293325
object CompilationTests extends ParallelTesting {

0 commit comments

Comments
 (0)