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 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
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
22 changes: 14 additions & 8 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 @@ -430,6 +433,15 @@ object Build {
case BootstrappedOptimised => `dotty-doc-optimised`
}

def testOnlyFiltered(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)
}

// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
lazy val commonDottyCompilerSettings = Seq(

Expand Down Expand Up @@ -574,14 +586,8 @@ object Build {
jarOpts ::: tuning ::: agentOptions ::: ci_build ::: path.toList
},

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

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