Skip to content

Commit 1bf0f98

Browse files
committed
Add a way filter FromTasty tests
In sbt use: `testFromTasty XYZ` It does the same as `testCompilation XYZ` but on the tasty tests
1 parent 1a7144a commit 1bf0f98

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,26 +1267,33 @@ trait ParallelTesting extends RunnerOrchestration { self =>
12671267

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

1270-
val targets =
1271-
files.map { f =>
1272-
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
1273-
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
1274-
}
1270+
val filteredFiles = testFilter match {
1271+
case Some(str) => files.filter(_.getAbsolutePath.contains(str))
1272+
case None => files
1273+
}
1274+
1275+
val targets = filteredFiles.map { f =>
1276+
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
1277+
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, fromTasty = true)
1278+
}
12751279
// TODO add SeparateCompilationSource from tasty?
12761280

12771281
val targets2 =
1278-
files
1282+
filteredFiles
12791283
.filter(f => dotty.tools.io.File(f.toPath).changeExtension("decompiled").exists)
12801284
.map { f =>
1281-
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
1282-
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, decompilation = true)
1283-
}
1285+
val classpath = createOutputDirsForFile(f, sourceDir, outDir)
1286+
JointCompilationSource(testGroup.name, Array(f), flags.withClasspath(classpath.getPath), classpath, decompilation = true)
1287+
}
12841288

12851289
// Create a CompilationTest and let the user decide whether to execute a pos or a neg test
12861290
val generateClassFiles = compileFilesInDir(f, flags0, blacklist)
12871291

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

1294+
if (targets2.isEmpty)
1295+
new JFile(decompilationDir).mkdirs()
1296+
12901297
new TastyCompilationTest(
12911298
generateClassFiles.keepOutput,
12921299
new CompilationTest(targets).keepOutput,

project/Build.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ object Build {
6565
// Run tests with filter through vulpix test suite
6666
lazy val testCompilation = inputKey[Unit]("runs integration test with the supplied filter")
6767

68+
// Run TASTY tests with filter through vulpix test suite
69+
lazy val testFromTasty = inputKey[Unit]("runs tasty integration test with the supplied filter")
70+
6871
// Spawns a repl with the correct classpath
6972
lazy val repl = inputKey[Unit]("run the REPL with correct classpath")
7073

@@ -583,6 +586,15 @@ object Build {
583586
(testOnly in Test).toTask(cmd)
584587
}.evaluated,
585588

589+
testFromTasty := Def.inputTaskDyn {
590+
val args: Seq[String] = spaceDelimited("<arg>").parsed
591+
val cmd = " dotty.tools.dotc.FromTastyTests -- " + {
592+
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
593+
else ""
594+
}
595+
(testOnly in Test).toTask(cmd)
596+
}.evaluated,
597+
586598
dotr := {
587599
val args: List[String] = spaceDelimited("<arg>").parsed.toList
588600
val attList = (dependencyClasspath in Runtime).value

0 commit comments

Comments
 (0)