Skip to content

Commit 7c42277

Browse files
committed
Make vulpix test filter work on substring instead of regexp
1 parent bcdacee commit 7c42277

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CompilationTests extends ParallelTesting {
1919
def numberOfSlaves = 5
2020
def safeMode = Properties.testsSafeMode
2121
def isInteractive = SummaryReport.isInteractive
22-
def testFilter = Properties.testsFilter.map(r => new Regex(r))
22+
def testFilter = Properties.testsFilter
2323

2424
// Positive tests ------------------------------------------------------------
2525

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
3838
*/
3939
def isInteractive: Boolean
4040

41-
/** A regex which is used to filter which tests to run, if `None` will run
42-
* all tests
41+
/** A string which is used to filter which tests to run, if `None` will run
42+
* all tests. All absolute paths that contain the substring `testFilter`
43+
* will be run
4344
*/
44-
def testFilter: Option[Regex]
45+
def testFilter: Option[String]
4546

4647
/** A test source whose files or directory of files is to be compiled
4748
* in a specific way defined by the `Test`
@@ -51,14 +52,14 @@ trait ParallelTesting extends RunnerOrchestration { self =>
5152
def outDir: JFile
5253
def flags: Array[String]
5354

54-
def classPath: String = {
55-
val (beforeCp, cpAndAfter) = flags.toList.span(_ != "-classpath")
56-
if (cpAndAfter.nonEmpty) {
57-
val (_ :: cpArg :: _) = cpAndAfter
58-
s"${outDir.getAbsolutePath}:" + cpArg
59-
}
60-
else outDir.getAbsolutePath
61-
}
55+
def classPath: String =
56+
outDir.getAbsolutePath +
57+
flags
58+
.dropWhile(_ != "-classpath")
59+
.drop(1)
60+
.headOption
61+
.map(":" + _)
62+
.getOrElse("")
6263

6364

6465
def title: String = self match {
@@ -224,9 +225,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
224225
if (!testFilter.isDefined) testSources
225226
else testSources.filter {
226227
case JointCompilationSource(_, files, _, _) =>
227-
files.exists(file => testFilter.get.findFirstIn(file.getAbsolutePath).isDefined)
228+
files.exists(file => file.getAbsolutePath.contains(testFilter.get))
228229
case SeparateCompilationSource(_, dir, _, _) =>
229-
testFilter.get.findFirstIn(dir.getAbsolutePath).isDefined
230+
dir.getAbsolutePath.contains(testFilter.get)
230231
}
231232

232233
/** Total amount of test sources being compiled by this test */
@@ -420,7 +421,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
420421
}
421422
else echo {
422423
testFilter
423-
.map(r => s"""No files matched regex "$r" in test""")
424+
.map(r => s"""No files matched "$r" in test""")
424425
.getOrElse("No tests available under target - erroneous test?")
425426
}
426427

@@ -475,7 +476,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
475476
summaryReport.addStartingMessage {
476477
"""|WARNING
477478
|-------
478-
|Run tests were only compiled, not run - this is due to `dotty.tests.norun`
479+
|Run tests were only compiled, not run - this is due to the `dotty.tests.norun`
479480
|property being set
480481
|""".stripMargin
481482
}

0 commit comments

Comments
 (0)