Skip to content

Commit b89248f

Browse files
committed
Fix tastyBootstrap test to also compile tasty-core
tasty-core is a dotty project, so when bootstrapping it needs to be recompiled and cannot be reused as is, the test did not fail so far since we didn't break anything, but it could be made to break by bumping the tasty version in TastyFormat. Also use change the names of the output directories of lib, dotty1 and dotty2 to match the group name.
1 parent 98034c3 commit b89248f

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

+25-18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.junit.Assert._
77
import org.junit.Assume._
88
import org.junit.experimental.categories.Category
99

10+
import java.io.File
1011
import java.nio.file._
1112
import java.util.stream.{ Stream => JStream }
1213
import scala.collection.JavaConverters._
@@ -197,45 +198,50 @@ class CompilationTests extends ParallelTesting {
197198
*/
198199
@Test def tastyBootstrap: Unit = {
199200
implicit val testGroup: TestGroup = TestGroup("tastyBootstrap/tests")
201+
val libGroup = TestGroup("tastyBootstrap/lib")
202+
val tastyCoreGroup = TestGroup("tastyBootstrap/tastyCore")
200203
val dotty1Group = TestGroup("tastyBootstrap/dotty1")
201204
val dotty2Group = TestGroup("tastyBootstrap/dotty2")
202-
val libGroup = TestGroup("tastyBootstrap/lib")
203205

204206
// Make sure that the directory is clean
205207
dotty.tools.io.Directory(defaultOutputDir + "tastyBootstrap").deleteRecursively()
206208

207-
val sep = java.io.File.pathSeparator
208-
209209
val opt = TestFlags(
210-
// compile with bootstrapped library on cp:
211-
defaultOutputDir + libGroup + "/src/" + sep +
212-
// as well as bootstrapped compiler:
213-
defaultOutputDir + dotty1Group + "/dotty/" + sep +
214-
// and the other compiler dependenies:
215-
Properties.compilerInterface + sep + Properties.scalaLibrary + sep + Properties.scalaAsm + sep +
216-
Properties.dottyInterfaces + sep + Properties.tastyCore + sep + Properties.jlineTerminal + sep +
217-
Properties.jlineReader,
210+
List(
211+
// compile with bootstrapped library on cp:
212+
defaultOutputDir + libGroup + "/lib/",
213+
// and bootstrapped tasty-core:
214+
defaultOutputDir + tastyCoreGroup + "/tastyCore/",
215+
// as well as bootstrapped compiler:
216+
defaultOutputDir + dotty1Group + "/dotty1/",
217+
// and the other compiler dependencies:
218+
Properties.compilerInterface, Properties.scalaLibrary, Properties.scalaAsm,
219+
Properties.dottyInterfaces, Properties.jlineTerminal, Properties.jlineReader,
220+
).mkString(File.pathSeparator),
218221
Array("-Ycheck-reentrant", "-Yemit-tasty-in-class")
219222
)
220223

221224
val libraryDirs = List(Paths.get("library/src"), Paths.get("library/src-bootstrapped"))
222225
val librarySources = libraryDirs.flatMap(sources(_))
223226

224227
val lib =
225-
compileList("src", librarySources,
228+
compileList("lib", librarySources,
226229
defaultOptions.and("-Ycheck-reentrant",
227230
"-Yerased-terms", // support declaration of scala.compiletime.erasedValue
228231
// "-strict", // TODO: re-enable once we allow : @unchecked in pattern definitions. Right now, lots of narrowing pattern definitions fail.
229232
"-priorityclasspath", defaultOutputDir))(libGroup)
230233

234+
val tastyCoreSources = sources(Paths.get("tasty/src"))
235+
val tastyCore = compileList("tastyCore", tastyCoreSources, opt)(tastyCoreGroup)
236+
231237
val compilerSources = sources(Paths.get("compiler/src"))
232238
val compilerManagedSources = sources(Properties.dottyCompilerManagedSources)
233239

234-
val dotty1 = compileList("dotty", compilerSources ++ compilerManagedSources, opt)(dotty1Group)
235-
val dotty2 = compileList("dotty", compilerSources ++ compilerManagedSources, opt)(dotty2Group)
240+
val dotty1 = compileList("dotty1", compilerSources ++ compilerManagedSources, opt)(dotty1Group)
241+
val dotty2 = compileList("dotty2", compilerSources ++ compilerManagedSources, opt)(dotty2Group)
236242

237243
val tests = {
238-
lib.keepOutput :: dotty1.keepOutput :: aggregateTests(
244+
lib.keepOutput :: tastyCore.keepOutput :: dotty1.keepOutput :: aggregateTests(
239245
dotty2,
240246
compileShallowFilesInDir("compiler/src/dotty/tools", opt),
241247
compileShallowFilesInDir("compiler/src/dotty/tools/dotc", opt),
@@ -255,9 +261,10 @@ class CompilationTests extends ParallelTesting {
255261
}.map(_.checkCompile())
256262

257263
def assertExists(path: String) = assertTrue(Files.exists(Paths.get(path)))
258-
assertExists(s"out/$dotty1Group/dotty/")
259-
assertExists(s"out/$dotty2Group/dotty/")
260-
assertExists(s"out/$libGroup/src/")
264+
assertExists(s"out/$libGroup/lib/")
265+
assertExists(s"out/$tastyCoreGroup/tastyCore/")
266+
assertExists(s"out/$dotty1Group/dotty1/")
267+
assertExists(s"out/$dotty2Group/dotty2/")
261268
compileList("idempotency", List("tests/idempotency/BootstrapChecker.scala", "tests/idempotency/IdempotencyCheck.scala"), defaultOptions).checkRuns()
262269

263270
tests.foreach(_.delete())
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
object Test {
33
def main(args: Array[String]): Unit =
4-
IdempotencyCheck.checkIdempotency("out/tastyBootstrap/dotty1", "out/tastyBootstrap/dotty2")
4+
IdempotencyCheck.checkIdempotency("out/tastyBootstrap/dotty1/dotty1", "out/tastyBootstrap/dotty2/dotty2")
55
}

0 commit comments

Comments
 (0)