From 784586ddfe55f347aef41b13007a0caa8f52d9fe Mon Sep 17 00:00:00 2001 From: Anatolii Kmetiuk Date: Wed, 25 Mar 2026 10:48:08 +0900 Subject: [PATCH] Fix separate compilation tests failing under coverage --- compiler/test/dotc/scoverage-ignore.excludelist | 4 ---- .../test/dotty/tools/vulpix/ParallelTesting.scala | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/test/dotc/scoverage-ignore.excludelist b/compiler/test/dotc/scoverage-ignore.excludelist index cca11d59c56b..a227df2029b8 100644 --- a/compiler/test/dotc/scoverage-ignore.excludelist +++ b/compiler/test/dotc/scoverage-ignore.excludelist @@ -5,12 +5,8 @@ # Empty lines are ignored 16583.scala -alphanumeric-infix-operator-compat annotation-named-pararamters applied_constructor_types.scala -backwardCompat-3.0 -backwardCompat-3.1 -backwardsCompat-implicitParens bridges.scala capt1.scala capture.scala diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index d5fec91101ef..ea2dee2a1ed5 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -615,6 +615,15 @@ trait ParallelTesting extends RunnerOrchestration with CoverageSupport: addToLast(barLine(start = false)) diagnostics.reverse + /** Older compilers don't support `-coverage-out` or `-Ycheck:instrumentCoverage`. */ + private def stripCoverageOptions(flags: TestFlags): TestFlags = + def loop(opts: List[String]): List[String] = opts match + case "-coverage-out" :: _ :: tail => loop(tail) + case flag :: tail if flag.startsWith("-Ycheck:") && flag.contains("instrumentCoverage") => loop(tail) + case other :: tail => other :: loop(tail) + case Nil => Nil + flags.copy(options = loop(flags.options.toList).toArray) + protected def compileWithOtherCompiler(compiler: String, files: Array[JFile], flags: TestFlags, targetDir: JFile): TestReporter = def artifactClasspath(organizationName: String, moduleName: String) = import coursier._ @@ -652,7 +661,7 @@ trait ParallelTesting extends RunnerOrchestration with CoverageSupport: def scala3Command(): Array[String] = { val stdlibClasspath = artifactClasspath("org.scala-lang", "scala3-library_3") val scalacClasspath = artifactClasspath("org.scala-lang", "scala3-compiler_3") - val flagsArgs = flags + val flagsArgs = stripCoverageOptions(flags) .copy(defaultClassPath = stdlibClasspath) .withClasspath(targetDir.getPath) .and("-d", targetDir.getPath)