diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 497d68138f50..26593ffd7fc5 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -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, diff --git a/project/Build.scala b/project/Build.scala index 2130d1b552ea..592457e43542 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -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") @@ -430,6 +433,15 @@ object Build { case BootstrappedOptimised => `dotty-doc-optimised` } + def testOnlyFiltered(test: String, options: String) = Def.inputTaskDyn { + val args = spaceDelimited("").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( @@ -574,14 +586,8 @@ object Build { jarOpts ::: tuning ::: agentOptions ::: ci_build ::: path.toList }, - testCompilation := Def.inputTaskDyn { - val args: Seq[String] = spaceDelimited("").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("").parsed.toList