Skip to content

Commit 868d199

Browse files
Merge pull request #4607 from dotty-staging/filter-from-tasty-tests
Add a way filter FromTasty tests
2 parents ce4633d + cf4b22a commit 868d199

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
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: 14 additions & 8 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

@@ -430,6 +433,15 @@ object Build {
430433
case BootstrappedOptimised => `dotty-doc-optimised`
431434
}
432435

436+
def testOnlyFiltered(test: String, options: String) = Def.inputTaskDyn {
437+
val args = spaceDelimited("<arg>").parsed
438+
val cmd = s" $test -- $options" + {
439+
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
440+
else ""
441+
}
442+
(testOnly in Test).toTask(cmd)
443+
}
444+
433445
// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
434446
lazy val commonDottyCompilerSettings = Seq(
435447

@@ -574,14 +586,8 @@ object Build {
574586
jarOpts ::: tuning ::: agentOptions ::: ci_build ::: path.toList
575587
},
576588

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

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

0 commit comments

Comments
 (0)