Skip to content

Fix the reproduction script for testFromTasty tests #4832

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
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
29 changes: 27 additions & 2 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1274,9 +1274,34 @@ trait ParallelTesting extends RunnerOrchestration { self =>
case None => files
}

class JointCompilationSourceFromTasty(
name: String,
file: JFile,
flags: TestFlags,
outDir: JFile,
fromTasty: Boolean = false,
decompilation: Boolean = false
) extends JointCompilationSource(name, Array(file), flags, outDir, fromTasty, decompilation) {

override def buildInstructions(errors: Int, warnings: Int): String = {
val runOrPos = if (file.getPath.startsWith("tests/run/")) "run" else "pos"
val listName = if (fromTasty) "from-tasty" else "decompilation"
s"""|
|Test '$title' compiled with $errors error(s) and $warnings warning(s),
|the test can be reproduced by running:
|
| sbt "testFromTasty $file"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the easiest way to reproduce but is it helpful for debugging? My experience is that when you run a test with vulpix and the compiler crashes then the exception is swallowed and I either need to look at the test log or run the compiler manually.

I often want to run the compiler manually outside vulpix and I would rather have the manual instructions. E.g:

> dotc -d tmp Foo.scala -some-options
> dotc Foo -classpath tmp -from-tasty -some-options

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that there is no way at this point to know which are the inputs (class names) of the second script. I will try to come up with something more precise but for now, it is more important to emit a report that gives a correct way to reproduce the error.

|
|This tests can be disabled by adding `${file.getName}` to `compiler/test/dotc/$runOrPos-$listName.blacklist`
|
|""".stripMargin
}

}

val targets = filteredFiles.map { f =>
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
new JointCompilationSourceFromTasty(testGroup.name, f, flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
}
// TODO add SeparateCompilationSource from tasty?

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

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