Skip to content

Commit 6240daa

Browse files
Merge pull request #4832 from dotty-staging/fix-reproduction-instructions-for-from-tasty-tests
Fix the reproduction script for testFromTasty tests
2 parents 73c899f + 5edcee6 commit 6240daa

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,9 +1274,34 @@ trait ParallelTesting extends RunnerOrchestration { self =>
12741274
case None => files
12751275
}
12761276

1277+
class JointCompilationSourceFromTasty(
1278+
name: String,
1279+
file: JFile,
1280+
flags: TestFlags,
1281+
outDir: JFile,
1282+
fromTasty: Boolean = false,
1283+
decompilation: Boolean = false
1284+
) extends JointCompilationSource(name, Array(file), flags, outDir, fromTasty, decompilation) {
1285+
1286+
override def buildInstructions(errors: Int, warnings: Int): String = {
1287+
val runOrPos = if (file.getPath.startsWith("tests/run/")) "run" else "pos"
1288+
val listName = if (fromTasty) "from-tasty" else "decompilation"
1289+
s"""|
1290+
|Test '$title' compiled with $errors error(s) and $warnings warning(s),
1291+
|the test can be reproduced by running:
1292+
|
1293+
| sbt "testFromTasty $file"
1294+
|
1295+
|This tests can be disabled by adding `${file.getName}` to `compiler/test/dotc/$runOrPos-$listName.blacklist`
1296+
|
1297+
|""".stripMargin
1298+
}
1299+
1300+
}
1301+
12771302
val targets = filteredFiles.map { f =>
12781303
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
1279-
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
1304+
new JointCompilationSourceFromTasty(testGroup.name, f, flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
12801305
}
12811306
// TODO add SeparateCompilationSource from tasty?
12821307

@@ -1285,7 +1310,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
12851310
.filter(f => decompilationFilter.accept(f.getName))
12861311
.map { f =>
12871312
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
1288-
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, decompilation = true)
1313+
new JointCompilationSourceFromTasty(testGroup.name, f, flags.withClasspath(classpath.getPath), classpath, decompilation = true)
12891314
}
12901315

12911316
// Create a CompilationTest and let the user decide whether to execute a pos or a neg test

0 commit comments

Comments
 (0)