Skip to content

Commit 204182b

Browse files
committed
partest: Enable separate compilation
partest can separately compile files based on their suffix (_1, _2, ...), it turns out that this feature was never enabled in the dotty version of partest and no one noticed (it prints warnings in ./tests/partest-generated/gen.log which no one reads). Enabling this revealed some latent separate compilation bugs that will be fixed in the next few commits.
1 parent 845b981 commit 204182b

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

test/dotty/partest/DPConsoleRunner.scala

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -245,32 +245,6 @@ class DPTestRunner(testFile: File, suiteRunner: DPSuiteRunner) extends nest.Runn
245245
} getOrElse true
246246
}
247247

248-
// override because Dotty currently doesn't handle separate compilation well,
249-
// so we ignore groups (tests suffixed with _1 and _2)
250-
override def groupedFiles(sources: List[File]): List[List[File]] = {
251-
val grouped = sources groupBy (_.group)
252-
val flatGroup = List(grouped.keys.toList.sorted.map({ k => grouped(k) sortBy (_.getName) }).flatten)
253-
try { // try/catch because of bug in partest that throws exception
254-
if (flatGroup != super.groupedFiles(sources))
255-
throw new java.lang.UnsupportedOperationException()
256-
} catch {
257-
case e: java.lang.UnsupportedOperationException =>
258-
val genlogFWriter = new FileWriter(DPConfig.genLog.jfile, true)
259-
val genlogWriter = new PrintWriter(genlogFWriter, true)
260-
genlogWriter.println("Warning: Overriding compilation groups for tests: " + sources)
261-
genlogWriter.close
262-
genlogFWriter.close
263-
}
264-
flatGroup
265-
}
266-
267-
// override to avoid separate compilation of scala and java sources
268-
override def mixedCompileGroup(allFiles: List[File]): List[CompileRound] = List(OnlyDotty(allFiles))
269-
case class OnlyDotty(fs: List[File]) extends CompileRound {
270-
def description = s"dotc $fsString"
271-
lazy val result = { pushTranscript(description) ; attemptCompile(fs) }
272-
}
273-
274248
// override to add dotty and scala jars to classpath
275249
override def extraClasspath = suiteRunner.fileManager.asInstanceOf[DottyFileManager].extraJarList ::: super.extraClasspath
276250

test/test/CompilerTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ abstract class CompilerTest {
397397
nr: Int = 0, oldOutput: String = defaultOutputDir): Unit = {
398398

399399
val partestOutput = dest.jfile.getParentFile + JFile.separator + dest.stripExtension + "-" + kind + ".obj"
400-
val flags = oldFlags.map(f => if (f == oldOutput) partestOutput else f)
400+
val flags = oldFlags.map(f => if (f == oldOutput) partestOutput else f) ++
401+
List(s"-classpath $partestOutput") // Required for separate compilation tests
401402

402403
getExisting(dest).isDifferent(source, flags, nerr) match {
403404
case NotExists => copyFiles(source, dest, partestOutput, flags, nerr, kind)

0 commit comments

Comments
 (0)