Skip to content

Add a way filter FromTasty tests #4607

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 3 commits into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 16 additions & 9 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1267,26 +1267,33 @@ trait ParallelTesting extends RunnerOrchestration { self =>

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

val targets =
files.map { f =>
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
}
val filteredFiles = testFilter match {
case Some(str) => files.filter(_.getAbsolutePath.contains(str))
case None => files
}

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

val targets2 =
files
filteredFiles
.filter(f => dotty.tools.io.File(f.toPath).changeExtension("decompiled").exists)
.map { f =>
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, decompilation = true)
}
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
JointCompilationSource(testGroup.name, Array(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
val generateClassFiles = compileFilesInDir(f, flags0, blacklist)

val decompilationDir = outDir + sourceDir.getName + "_decompiled"

if (targets2.isEmpty)
new JFile(decompilationDir).mkdirs()

new TastyCompilationTest(
generateClassFiles.keepOutput,
new CompilationTest(targets).keepOutput,
Expand Down
12 changes: 12 additions & 0 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ object Build {
// Run tests with filter through vulpix test suite
lazy val testCompilation = inputKey[Unit]("runs integration test with the supplied filter")

// Run TASTY tests with filter through vulpix test suite
lazy val testFromTasty = inputKey[Unit]("runs tasty integration test with the supplied filter")

// Spawns a repl with the correct classpath
lazy val repl = inputKey[Unit]("run the REPL with correct classpath")

Expand Down Expand Up @@ -583,6 +586,15 @@ object Build {
(testOnly in Test).toTask(cmd)
}.evaluated,

testFromTasty := Def.inputTaskDyn {
val args: Seq[String] = spaceDelimited("<arg>").parsed
val cmd = " dotty.tools.dotc.FromTastyTests -- " + {
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
else ""
}
(testOnly in Test).toTask(cmd)
}.evaluated,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's abstract over the testOnly input task:

def testOnly(test: String, options: String) = Def.inputTaskDyn {
  val args = spaceDelimited("<arg>").parsed
  val cmd = s" $test -- $options" + {
    if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
    else ""
  }
  (testOnly in Test).toTask(cmd)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


dotr := {
val args: List[String] = spaceDelimited("<arg>").parsed.toList
val attList = (dependencyClasspath in Runtime).value
Expand Down