Skip to content

Commit 8006da3

Browse files
Kordyjanprolativ
authored andcommitted
Fix pickler tests
1 parent 2be4d79 commit 8006da3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,20 @@ trait ParallelTesting extends RunnerOrchestration { self =>
176176
) extends TestSource {
177177
case class Group(ordinal: Int, compiler: String, target: String)
178178

179-
def compilationGroups: List[(Group, Array[JFile])] =
180-
val Name = """[^_]*((?:_.*)*)\.\w+""".r
179+
lazy val compilationGroups: List[(Group, Array[JFile])] =
181180
val Target = """t([\d\.]+)""".r
182181
val Compiler = """v([\d\.]+)""".r
183182
val Ordinal = """(\d+)""".r
184183
def groupFor(file: JFile): Group =
185-
val Name(annotPart) = file.getName
184+
val annotPart = file.getName.dropWhile(_ != '_').stripSuffix(".scala").stripSuffix(".java")
186185
val annots = annotPart.split("_")
187186
val ordinal = annots.collectFirst { case Ordinal(n) => n.toInt }.getOrElse(Int.MinValue)
188187
val target = annots.collectFirst { case Target(t) => t }.getOrElse("")
189188
val compiler = annots.collectFirst { case Compiler(c) => c}.getOrElse("")
190189
Group(ordinal, compiler, target)
191190

192191
dir.listFiles
192+
.filter(isSourceFile)
193193
.groupBy(groupFor)
194194
.toList
195195
.sortBy { (g, _) => (g.ordinal, g.compiler, g.target) }
@@ -1255,14 +1255,14 @@ trait ParallelTesting extends RunnerOrchestration { self =>
12551255
val (dirs, files) = compilationTargets(sourceDir, fileFilter)
12561256

12571257
val isPicklerTest = flags.options.contains("-Ytest-pickler")
1258-
def ignoreDir(dir: JFile): Boolean = {
1258+
def picklerDirFilter(source: SeparateCompilationSource): Boolean = {
12591259
// Pickler tests stop after pickler not producing class/tasty files. The second part of the compilation
12601260
// will not be able to compile due to the missing artifacts from the first part.
1261-
isPicklerTest && dir.listFiles().exists(file => file.getName.endsWith("_2.scala") || file.getName.endsWith("_2.java"))
1261+
!isPicklerTest || source.compilationGroups.length == 1
12621262
}
12631263
val targets =
12641264
files.map(f => JointCompilationSource(testGroup.name, Array(f), flags, createOutputDirsForFile(f, sourceDir, outDir))) ++
1265-
dirs.collect { case dir if !ignoreDir(dir) => SeparateCompilationSource(testGroup.name, dir, flags, createOutputDirsForDir(dir, sourceDir, outDir)) }
1265+
dirs.map { dir => SeparateCompilationSource(testGroup.name, dir, flags, createOutputDirsForDir(dir, sourceDir, outDir)) }.filter(picklerDirFilter)
12661266

12671267
// Create a CompilationTest and let the user decide whether to execute a pos or a neg test
12681268
new CompilationTest(targets)

0 commit comments

Comments
 (0)