Skip to content

Add regression tests for #3594 #3693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 62 additions & 63 deletions compiler/test/dotty/tools/dotc/FromTastyTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,76 +22,75 @@ class FromTastyTests extends ParallelTesting {

@Test def posTestFromTasty: Unit = {
implicit val testGroup: TestGroup = TestGroup("posTestFromTasty")
val (step1, step2) = {
// compileTastyInDir("../tests/pos", defaultOptions) + // FIXME
// compileTasty("../tests/pos/t115.scala", defaultOptions) +
// compileTasty("../tests/pos/t2127.scala", defaultOptions) +
// compileTasty("../tests/pos/i1570.scala", defaultOptions) +
// compileTasty("../tests/pos/t1279a.scala", defaultOptions) +
// compileTasty("../tests/pos/i3129.scala", defaultOptions) +
// compileTasty("../tests/pos/i2250.scala", defaultOptions) +
// compileTasty("../tests/pos/i966.scala", defaultOptions) +
// compileTasty("../tests/pos/t0049.scala", defaultOptions) +
// compileTasty("../tests/pos/i0306.scala", defaultOptions) +
// compileTasty("../tests/pos/t0055.scala", defaultOptions) +
// compileTasty("../tests/pos/i2397.scala", defaultOptions) +
// compileTasty("../tests/pos/i1365.scala", defaultOptions) +
// compileTasty("../tests/pos/t1957.scala", defaultOptions) +
// compileTasty("../tests/pos/i1756.scala", defaultOptions) +
// compileTasty("../tests/pos/i3130d.scala", defaultOptions) +
// compileTasty("../tests/pos/i1990a.scala", defaultOptions) +
// compileTasty("../tests/pos/i996.scala", defaultOptions) +
// compileTasty("../tests/pos/companions.scala", defaultOptions) +
// compileTasty("../tests/pos/i1812.scala", defaultOptions) +
// compileTasty("../tests/pos/i2944.scala", defaultOptions) +
// compileTasty("../tests/pos/i2468.scala", defaultOptions) +
// compileTasty("../tests/pos/i2300.scala", defaultOptions) +
// compileTasty("../tests/pos/i1990.scala", defaultOptions) +
// compileTasty("../tests/pos/i1812b.scala", defaultOptions) +
// compileTasty("../tests/pos/t2405.scala", defaultOptions) +
// compileTasty("../tests/pos/supercalls.scala", defaultOptions) +
// compileTasty("../tests/pos/hklub0.scala", defaultOptions) +
// compileTasty("../tests/pos/i3130a.scala", defaultOptions) +
compileTastyInDir("../tests/pos-from-tasty", defaultOptions) +
compileTasty("../tests/pos-from-tasty/simpleClass.scala", defaultOptions)
}
val (step1, step2) = compileTastyInDir("../tests/pos", defaultOptions,
blacklist = Set(
"Meter.scala",
"NoCyclicReference.scala",
"depfuntype.scala",
"hklub0.scala",
"i0306.scala",
"i1365.scala",
"i1795.scala",
"i2345.scala",
"i2888.scala",
"i2944.scala",
"i2980.scala",
"i3000.scala",
"i536.scala",
"i974.scala",
"liftable.scala",
"quoteTest.scala",
"quoted.scala",
"stagedInterpreter.scala",
"superacc.scala",
"t0231.scala",
"t1203a.scala",
"t2260.scala",
"t3612.scala", // Test never finishes
"t3800.scala",
"t4579.scala",
"t8023.scala",
"tcpoly_ticket2096.scala",
"t247.scala",
)
)
step1.checkCompile() // Compile all files to generate the class files with tasty
step2.checkCompile() // Compile from tasty
(step1 + step2).delete()
}

@Test def runTestFromTasty: Unit = {
implicit val testGroup: TestGroup = TestGroup("runTestFromTasty")
val (step1, step2) = {
// compileTastyInDir("../tests/run", defaultOptions) + // FIXME
// compileTasty("../tests/run/t3613.scala", defaultOptions) +
// compileTasty("../tests/run/i1569.scala", defaultOptions) +
// compileTasty("../tests/run/i2337.scala", defaultOptions) +
// compileTasty("../tests/run/t2127.scala", defaultOptions) +
// compileTasty("../tests/run/scala2trait-lazyval.scala", defaultOptions) +
// compileTasty("../tests/run/t6666a.scala", defaultOptions) +
// compileTasty("../tests/run/t3452f.scala", defaultOptions) +
// compileTasty("../tests/run/t6957.scala", defaultOptions) +
// compileTasty("../tests/run/inlinedAssign.scala", defaultOptions) +
// compileTasty("../tests/run/bridges.scala", defaultOptions) +
// compileTasty("../tests/run/t8002.scala", defaultOptions) +
// compileTasty("../tests/run/t6506.scala", defaultOptions) +
// compileTasty("../tests/run/enum-approx.scala", defaultOptions) +
// compileTasty("../tests/run/i2337b.scala", defaultOptions) +
// compileTasty("../tests/run/array-addition.scala", defaultOptions) +
// compileTasty("../tests/run/t1909c.scala", defaultOptions) +
// compileTasty("../tests/run/i2163.scala", defaultOptions) +
// compileTasty("../tests/run/t8395.scala", defaultOptions) +
// compileTasty("../tests/run/view-iterator-stream.scala", defaultOptions) +
// compileTasty("../tests/run/Course-2002-13.scala", defaultOptions) +
// compileTasty("../tests/run/NestedClasses.scala", defaultOptions) +
// compileTasty("../tests/run/inlineForeach.scala", defaultOptions) +
// compileTasty("../tests/run/i1990b.scala", defaultOptions) +
// compileTasty("../tests/run/t3048.scala", defaultOptions) +
// compileTasty("../tests/run/patmat-bind-typed.scala", defaultOptions) +
compileTastyInDir("../tests/run-from-tasty", defaultOptions) +
compileTasty("../tests/run/t493.scala", defaultOptions)
}
val (step1, step2) = compileTastyInDir("../tests/run", defaultOptions,
blacklist = Set(
"Course-2002-13.scala",
"NestedClasses.scala",
"bridges.scala",
"eff-dependent.scala",
"enum-approx.scala",
"i2337.scala",
"i2337b.scala",
"inlineForeach.scala",
"patmat-bind-typed.scala",
"phantom-decls-1.scala",
"phantom-decls-3.scala",
"phantom-decls-5.scala",
"phantom-hk-1.scala",
"phantom-hk-2.scala",
"phantom-in-value-class.scala",
"phantom-methods-3.scala",
"phantom-methods-4.scala",
"phantom-poly-1.scala",
"phantom-poly-2.scala",
"phantom-poly-3.scala",
"phantom-poly-4.scala",
"scala2trait-lazyval.scala",
"t3452f.scala",
"t493.scala",
"t8395.scala",
"t3613.scala",
)
)
step1.checkCompile() // Compile all files to generate the class files with tasty
step2.checkRuns() // Compile from tasty and run the result
(step1 + step2).delete()
Expand Down
16 changes: 9 additions & 7 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
}

/** Separates directories from files and returns them as `(dirs, files)` */
private def compilationTargets(sourceDir: JFile): (List[JFile], List[JFile]) =
private def compilationTargets(sourceDir: JFile, blacklist: Set[String] = Set.empty): (List[JFile], List[JFile]) =
sourceDir.listFiles.foldLeft((List.empty[JFile], List.empty[JFile])) { case ((dirs, files), f) =>
if (f.isDirectory) (f :: dirs, files)
if (blacklist(f.getName)) (dirs, files)
else if (f.isDirectory) (f :: dirs, files)
else if (isSourceFile(f)) (dirs, f :: files)
else (dirs, files)
}
Expand Down Expand Up @@ -1176,12 +1177,12 @@ trait ParallelTesting extends RunnerOrchestration { self =>
* - Directories can have an associated check-file, where the check file has
* the same name as the directory (with the file extension `.check`)
*/
def compileFilesInDir(f: String, flags: TestFlags)(implicit testGroup: TestGroup): CompilationTest = {
def compileFilesInDir(f: String, flags: TestFlags, blacklist: Set[String] = Set.empty)(implicit testGroup: TestGroup): CompilationTest = {
val outDir = defaultOutputDir + testGroup + "/"
val sourceDir = new JFile(f)
checkRequirements(f, sourceDir, outDir)

val (dirs, files) = compilationTargets(sourceDir)
val (dirs, files) = compilationTargets(sourceDir, blacklist)

val targets =
files.map(f => JointCompilationSource(testGroup.name, Array(f), flags, createOutputDirsForFile(f, sourceDir, outDir))) ++
Expand Down Expand Up @@ -1211,13 +1212,14 @@ trait ParallelTesting extends RunnerOrchestration { self =>
* Tests in the first part of the tuple must be executed before the second.
* Both testsRequires explicit delete().
*/
def compileTastyInDir(f: String, flags0: TestFlags)(implicit testGroup: TestGroup): (CompilationTest, CompilationTest) = {
def compileTastyInDir(f: String, flags0: TestFlags, blacklist: Set[String] = Set.empty)(
implicit testGroup: TestGroup): (CompilationTest, CompilationTest) = {
val outDir = defaultOutputDir + testGroup + "/"
val flags = flags0 and "-Yretain-trees"
val sourceDir = new JFile(f)
checkRequirements(f, sourceDir, outDir)

val (dirs, files) = compilationTargets(sourceDir)
val (dirs, files) = compilationTargets(sourceDir, blacklist)

val targets =
files.map { f =>
Expand All @@ -1227,7 +1229,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
// TODO add SeparateCompilationSource from tasty?

// Create a CompilationTest and let the user decide whether to execute a pos or a neg test
val generateClassFiles = compileFilesInDir(f, flags0)
val generateClassFiles = compileFilesInDir(f, flags0, blacklist)
(generateClassFiles.keepOutput, new CompilationTest(targets).keepOutput)
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.