diff --git a/compiler/test/dotc/comptest.scala b/compiler/test/dotc/comptest.scala index bb4961ea2a88..bd0d800e641c 100644 --- a/compiler/test/dotc/comptest.scala +++ b/compiler/test/dotc/comptest.scala @@ -10,7 +10,7 @@ object comptest extends ParallelTesting { def numberOfSlaves = 5 def safeMode = false def isInteractive = true - def testFilter = None + def testFilter = Nil def updateCheckFiles: Boolean = false val posDir = "./tests/pos/" diff --git a/compiler/test/dotty/Properties.scala b/compiler/test/dotty/Properties.scala index 042773505dc5..59ea8b1fd7d8 100644 --- a/compiler/test/dotty/Properties.scala +++ b/compiler/test/dotty/Properties.scala @@ -21,7 +21,7 @@ object Properties { /** Filter out tests not matching the regex supplied by "dotty.tests.filter" * define */ - val testsFilter: Option[String] = sys.props.get("dotty.tests.filter") + val testsFilter: List[String] = sys.props.get("dotty.tests.filter").fold(Nil)(_.split(',').toList) /** Tests should override the checkfiles with the current output */ val testsUpdateCheckfile: Boolean = diff --git a/compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala b/compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala index 6a9f0c74a56f..0c895d436238 100644 --- a/compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala +++ b/compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala @@ -65,7 +65,7 @@ class PatmatExhaustivityTest { .filter(f => f.extension == "scala" || f.isDirectory) .filter { f => val path = if f.isDirectory then f.path + "/" else f.path - Properties.testsFilter.getOrElse("").split(',').exists(path.contains) + Properties.testsFilter.isEmpty || Properties.testsFilter.exists(path.contains) } .map(f => if f.isDirectory then compileDir(f.jpath) else compileFile(f.jpath)) diff --git a/compiler/test/dotty/tools/utils.scala b/compiler/test/dotty/tools/utils.scala index a9792bf2f43c..f4cefbdc07fc 100644 --- a/compiler/test/dotty/tools/utils.scala +++ b/compiler/test/dotty/tools/utils.scala @@ -17,7 +17,7 @@ def scripts(path: String): Array[File] = { assert(dir.exists && dir.isDirectory, "Couldn't load scripts dir") dir.listFiles.filter { f => val path = if f.isDirectory then f.getPath + "/" else f.getPath - path.contains(Properties.testsFilter.getOrElse("")) + Properties.testsFilter.isEmpty || Properties.testsFilter.exists(path.contains) } } diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 4ba1229feecb..913b1bc3e69b 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -44,11 +44,11 @@ trait ParallelTesting extends RunnerOrchestration { self => */ def isInteractive: Boolean - /** A string which is used to filter which tests to run, if `None` will run - * all tests. All absolute paths that contain the substring `testFilter` + /** A list of strings which is used to filter which tests to run, if `Nil` will run + * all tests. All absolute paths that contain any of the substrings in `testFilter` * will be run */ - def testFilter: Option[String] + def testFilter: List[String] /** Tests should override the checkfiles with the current output */ def updateCheckFiles: Boolean @@ -340,12 +340,12 @@ trait ParallelTesting extends RunnerOrchestration { self => /** All testSources left after filtering out */ private val filteredSources = - if (!testFilter.isDefined) testSources + if (testFilter.isEmpty) testSources else testSources.filter { case JointCompilationSource(_, files, _, _, _, _) => - files.exists(file => file.getPath.contains(testFilter.get)) + testFilter.exists(filter => files.exists(file => file.getPath.contains(filter))) case SeparateCompilationSource(_, dir, _, _) => - dir.getPath.contains(testFilter.get) + testFilter.exists(dir.getPath.contains) } /** Total amount of test sources being compiled by this test */ @@ -581,9 +581,9 @@ trait ParallelTesting extends RunnerOrchestration { self => else reportPassed() } else echo { - testFilter - .map(r => s"""No files matched "$r" in test""") - .getOrElse("No tests available under target - erroneous test?") + testFilter match + case _ :: _ => s"""No files matched "${testFilter.mkString(",")}" in test""" + case _ => "No tests available under target - erroneous test?" } this @@ -1269,10 +1269,9 @@ trait ParallelTesting extends RunnerOrchestration { self => val (dirs, files) = compilationTargets(sourceDir, fromTastyFilter) - val filteredFiles = testFilter match { - case Some(str) => files.filter(_.getPath.contains(str)) - case None => files - } + val filteredFiles = testFilter match + case _ :: _ => files.filter(f => testFilter.exists(f.getPath.contains)) + case _ => Nil class JointCompilationSourceFromTasty( name: String, diff --git a/compiler/test/dotty/tools/vulpix/VulpixMetaTests.scala b/compiler/test/dotty/tools/vulpix/VulpixMetaTests.scala index befb4701f371..75af0aa94893 100644 --- a/compiler/test/dotty/tools/vulpix/VulpixMetaTests.scala +++ b/compiler/test/dotty/tools/vulpix/VulpixMetaTests.scala @@ -28,7 +28,7 @@ object VulpixMetaTests extends ParallelTesting { def numberOfSlaves = 1 def safeMode = false // Don't fork a new VM after each run test def isInteractive = false // Don't beautify output for interactive use. - def testFilter = None // Run all the tests. + def testFilter = Nil // Run all the tests. def updateCheckFiles: Boolean = false @AfterClass diff --git a/compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala b/compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala index cdbd55af61d4..432bb64bc1cf 100644 --- a/compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala +++ b/compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala @@ -104,7 +104,7 @@ object VulpixUnitTests extends ParallelTesting { def numberOfSlaves = 5 def safeMode = sys.env.get("SAFEMODE").isDefined def isInteractive = !sys.env.contains("DRONE") - def testFilter = None + def testFilter = Nil def updateCheckFiles: Boolean = false @AfterClass