Skip to content

Commit 6ed7b94

Browse files
committed
Enable compilation tests using parallel backend
1 parent 597e976 commit 6ed7b94

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

Diff for: compiler/test/dotty/tools/dotc/CompilationTests.scala

+33-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import scala.concurrent.duration._
1818
import TestSources.sources
1919
import reporting.TestReporter
2020
import vulpix._
21+
import dotty.tools.dotc.config.ScalaSettings
2122

2223
class CompilationTests {
2324
import ParallelTesting._
@@ -273,7 +274,6 @@ class CompilationTests {
273274
compileFilesInDir("tests/init/neg", options).checkExpectedErrors()
274275
compileFilesInDir("tests/init/pos", options).checkCompile()
275276
compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile()
276-
277277
// The regression test for i12128 has some atypical classpath requirements.
278278
// The test consists of three files: (a) Reflect_1 (b) Macro_2 (c) Test_3
279279
// which must be compiled separately. In addition:
@@ -295,6 +295,38 @@ class CompilationTests {
295295
tests.foreach(_.delete())
296296
}
297297
}
298+
299+
// parallel backend tests
300+
@Test def parallelBackend: Unit = {
301+
given TestGroup = TestGroup("parallelBackend")
302+
val parallelism = Runtime.getRuntime().availableProcessors().min(16)
303+
assumeTrue("Not enough available processors to run parallel tests", parallelism > 1)
304+
305+
val options = defaultOptions.and(s"-Ybackend-parallelism:${parallelism}")
306+
def parCompileDir(directory: String) = compileDir(directory, options)
307+
308+
// Compilation units containing more than 1 source file
309+
aggregateTests(
310+
parCompileDir("tests/pos/i10477"),
311+
parCompileDir("tests/pos/i4758"),
312+
parCompileDir("tests/pos/scala2traits"),
313+
parCompileDir("tests/pos/class-gadt"),
314+
parCompileDir("tests/pos/tailcall"),
315+
parCompileDir("tests/pos/reference"),
316+
parCompileDir("tests/pos/pos_valueclasses")
317+
).checkCompile()
318+
319+
aggregateTests(
320+
parCompileDir("tests/neg/package-implicit"),
321+
parCompileDir("tests/neg/package-export")
322+
).checkExpectedErrors()
323+
324+
aggregateTests(
325+
parCompileDir("tests/run/decorators"),
326+
parCompileDir("tests/run/generic")
327+
).checkRuns()
328+
329+
}
298330
}
299331

300332
object CompilationTests extends ParallelTesting {

0 commit comments

Comments
 (0)