Skip to content

Commit 9c94edc

Browse files
committed
Refactor filter in idempotency test
1 parent b80c3b7 commit 9c94edc

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ class IdempotencyTests {
1818
import IdempotencyTests._
1919
import CompilationTest.aggregateTests
2020

21+
val filter = FileFilter.exclude(
22+
s"pos${JFile.separator}i6507b"
23+
)
24+
2125
@Category(Array(classOf[SlowTests]))
2226
@Test def idempotency: Unit = {
2327
implicit val testGroup: TestGroup = TestGroup("idempotency")
2428
val opt = defaultOptions
2529

2630
val posIdempotency = aggregateTests(
27-
compileFilesInDir("tests/pos", opt)(TestGroup("idempotency/posIdempotency1")),
28-
compileFilesInDir("tests/pos", opt)(TestGroup("idempotency/posIdempotency2")),
31+
compileFilesInDir("tests/pos", opt, filter)(TestGroup("idempotency/posIdempotency1")),
32+
compileFilesInDir("tests/pos", opt, filter)(TestGroup("idempotency/posIdempotency2")),
2933
)
3034

3135
val orderIdempotency = {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ sealed trait FileFilter {
55
}
66

77
object FileFilter {
8+
def exclude(file: String): FileFilter = exclude(file :: Nil)
9+
10+
def exclude(file: String, files: String*): FileFilter =
11+
exclude(file :: files.toList)
812

913
def exclude(files: List[String]): FileFilter = new FileFilter {
1014
private val blackList = files.toSet

tests/idempotency/IdempotencyCheck.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ import java.util.stream.Stream as JStream
66
import scala.collection.JavaConverters.*
77

88
object IdempotencyCheck {
9-
val flakyTestsOnWindows =
10-
if scala.util.Properties.isWin
11-
then Set(s"pos${JFile.separator}i6507b")
12-
else Set.empty
13-
14-
val blacklisted = flakyTestsOnWindows
15-
169
def checkIdempotency(dir1: String, dir2: String): Unit = {
1710
var failed = 0
1811
var total = 0
@@ -32,7 +25,7 @@ object IdempotencyCheck {
3225
}
3326
val groups = bytecodeFiles.groupBy(_._1).mapValues(_.map(_._2))
3427

35-
groups.filterNot(x => blacklisted(x._1)).iterator.flatMap { g =>
28+
groups.iterator.flatMap { g =>
3629
def pred(f: JPath, dir: String, isTasty: Boolean) =
3730
f.toString.contains(dir) && f.toString.endsWith(if (isTasty) ".tasty" else ".class")
3831
val class1 = g._2.find(f => pred(f, dir1String, isTasty = false))

0 commit comments

Comments
 (0)