Skip to content

Commit 855bdcc

Browse files
smarterodersky
authored andcommitted
partest: Enable separate compilation and javac tests
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), tests with *.java files should be compiled both with javac and dotty, but compiling with javac was also disabled. Enabling this revealed some latent bugs that will be fixed in the next few commits.
1 parent b6882d6 commit 855bdcc

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
@@ -410,7 +410,8 @@ abstract class CompilerTest {
410410
nr: Int = 0, oldOutput: String = defaultOutputDir): Unit = {
411411

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

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

0 commit comments

Comments
 (0)