Skip to content

Commit 43d3ada

Browse files
committed
Replace CompilationTest + by aggregateTests
The motivation is to avoid bugs like the one fixed in scala#6423 to ever happen. In the previous scheme a missing `+` results in tests not being executed, while now a missing comma will be a compilation error.
1 parent 837c7a2 commit 43d3ada

File tree

4 files changed

+289
-259
lines changed

4 files changed

+289
-259
lines changed

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

Lines changed: 70 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
1717
import ParallelTesting._
1818
import TestConfiguration._
1919
import BootstrappedOnlyCompilationTests._
20+
import CompilationTest.aggregateTests
2021

2122
// Test suite configuration --------------------------------------------------
2223

@@ -31,58 +32,62 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
3132

3233
@Test def posMacros: Unit = {
3334
implicit val testGroup: TestGroup = TestGroup("compilePosMacros")
34-
compileFilesInDir("tests/pos-macros", defaultOptions)
35-
}.checkCompile()
35+
compileFilesInDir("tests/pos-macros", defaultOptions).checkCompile()
36+
}
3637

3738
@Test def posWithCompiler: Unit = {
3839
implicit val testGroup: TestGroup = TestGroup("compilePosWithCompiler")
39-
compileFilesInDir("tests/pos-with-compiler", withCompilerOptions) +
40-
compileDir("compiler/src/dotty/tools/dotc/ast", withCompilerOptions) +
41-
compileDir("compiler/src/dotty/tools/dotc/config", withCompilerOptions) +
42-
compileDir("compiler/src/dotty/tools/dotc/core", withCompilerOptions) +
43-
compileDir("compiler/src/dotty/tools/dotc/transform", withCompilerOptions) +
44-
compileDir("compiler/src/dotty/tools/dotc/parsing", withCompilerOptions) +
45-
compileDir("compiler/src/dotty/tools/dotc/printing", withCompilerOptions) +
46-
compileDir("compiler/src/dotty/tools/dotc/reporting", withCompilerOptions) +
47-
compileDir("compiler/src/dotty/tools/dotc/typer", withCompilerOptions) +
48-
compileDir("compiler/src/dotty/tools/dotc/util", withCompilerOptions) +
49-
compileDir("compiler/src/dotty/tools/io", withCompilerOptions)
50-
}.checkCompile()
40+
aggregateTests(
41+
compileFilesInDir("tests/pos-with-compiler", withCompilerOptions),
42+
compileDir("compiler/src/dotty/tools/dotc/ast", withCompilerOptions),
43+
compileDir("compiler/src/dotty/tools/dotc/config", withCompilerOptions),
44+
compileDir("compiler/src/dotty/tools/dotc/core", withCompilerOptions),
45+
compileDir("compiler/src/dotty/tools/dotc/transform", withCompilerOptions),
46+
compileDir("compiler/src/dotty/tools/dotc/parsing", withCompilerOptions),
47+
compileDir("compiler/src/dotty/tools/dotc/printing", withCompilerOptions),
48+
compileDir("compiler/src/dotty/tools/dotc/reporting", withCompilerOptions),
49+
compileDir("compiler/src/dotty/tools/dotc/typer", withCompilerOptions),
50+
compileDir("compiler/src/dotty/tools/dotc/util", withCompilerOptions),
51+
compileDir("compiler/src/dotty/tools/io", withCompilerOptions)
52+
).checkCompile()
53+
}
5154

5255
@Test def posTwiceWithCompiler: Unit = {
5356
implicit val testGroup: TestGroup = TestGroup("posTwiceWithCompiler")
54-
compileFile("tests/pos-with-compiler/Labels.scala", withCompilerOptions) +
55-
compileFile("tests/pos-with-compiler/Patterns.scala", withCompilerOptions) +
56-
compileList(
57-
"testNonCyclic",
58-
List(
59-
"compiler/src/dotty/tools/dotc/CompilationUnit.scala",
60-
"compiler/src/dotty/tools/dotc/core/Types.scala",
61-
"compiler/src/dotty/tools/dotc/ast/Trees.scala"
62-
),
63-
withCompilerOptions
64-
) +
65-
compileList(
66-
"testIssue34",
67-
List(
68-
"compiler/src/dotty/tools/dotc/config/Properties.scala",
69-
"compiler/src/dotty/tools/dotc/config/PathResolver.scala"
57+
aggregateTests(
58+
compileFile("tests/pos-with-compiler/Labels.scala", withCompilerOptions),
59+
compileFile("tests/pos-with-compiler/Patterns.scala", withCompilerOptions),
60+
compileList(
61+
"testNonCyclic",
62+
List(
63+
"compiler/src/dotty/tools/dotc/CompilationUnit.scala",
64+
"compiler/src/dotty/tools/dotc/core/Types.scala",
65+
"compiler/src/dotty/tools/dotc/ast/Trees.scala"
66+
),
67+
withCompilerOptions
7068
),
71-
withCompilerOptions
72-
)
73-
}.times(2).checkCompile()
69+
compileList(
70+
"testIssue34",
71+
List(
72+
"compiler/src/dotty/tools/dotc/config/Properties.scala",
73+
"compiler/src/dotty/tools/dotc/config/PathResolver.scala"
74+
),
75+
withCompilerOptions
76+
)
77+
).times(2).checkCompile()
78+
}
7479

7580
// Negative tests ------------------------------------------------------------
7681

7782
@Test def negMacros: Unit = {
7883
implicit val testGroup: TestGroup = TestGroup("compileNegWithCompiler")
79-
compileFilesInDir("tests/neg-macros", defaultOptions)
80-
}.checkExpectedErrors()
84+
compileFilesInDir("tests/neg-macros", defaultOptions).checkExpectedErrors()
85+
}
8186

8287
@Test def negWithCompiler: Unit = {
8388
implicit val testGroup: TestGroup = TestGroup("compileNegWithCompiler")
84-
compileFilesInDir("tests/neg-with-compiler", withCompilerOptions)
85-
}.checkExpectedErrors()
89+
compileFilesInDir("tests/neg-with-compiler", withCompilerOptions).checkExpectedErrors()
90+
}
8691

8792
// Run tests -----------------------------------------------------------------
8893

@@ -93,10 +98,12 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
9398

9499
@Test def runWithCompiler: Unit = {
95100
implicit val testGroup: TestGroup = TestGroup("runWithCompiler")
96-
compileFilesInDir("tests/run-with-compiler", withCompilerOptions) +
97-
compileDir("tests/run-with-compiler-custom-args/tasty-interpreter", withCompilerOptions) +
98-
compileFile("tests/run-with-compiler-custom-args/staged-streams_1.scala", withCompilerOptions without "-Yno-deep-subtypes")
99-
}.checkRuns()
101+
aggregateTests(
102+
compileFilesInDir("tests/run-with-compiler", withCompilerOptions),
103+
compileDir("tests/run-with-compiler-custom-args/tasty-interpreter", withCompilerOptions),
104+
compileFile("tests/run-with-compiler-custom-args/staged-streams_1.scala", withCompilerOptions without "-Yno-deep-subtypes")
105+
).checkRuns()
106+
}
100107

101108
// Pickling Tests ------------------------------------------------------------
102109
//
@@ -106,26 +113,28 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
106113
@Test def picklingWithCompiler: Unit = {
107114
val jvmBackendFilter = FileFilter.exclude(List("BTypes.scala", "Primitives.scala")) // TODO
108115
implicit val testGroup: TestGroup = TestGroup("testPicklingWithCompiler")
109-
compileDir("compiler/src/dotty/tools", picklingWithCompilerOptions, recursive = false) +
110-
compileDir("compiler/src/dotty/tools/dotc", picklingWithCompilerOptions, recursive = false) +
111-
compileDir("library/src/dotty/runtime", picklingWithCompilerOptions) +
112-
compileFilesInDir("compiler/src/dotty/tools/backend/jvm", picklingWithCompilerOptions, jvmBackendFilter) +
113-
compileDir("compiler/src/dotty/tools/dotc/ast", picklingWithCompilerOptions) +
114-
compileDir("compiler/src/dotty/tools/dotc/core", picklingWithCompilerOptions, recursive = false) +
115-
compileDir("compiler/src/dotty/tools/dotc/config", picklingWithCompilerOptions) +
116-
compileDir("compiler/src/dotty/tools/dotc/parsing", picklingWithCompilerOptions) +
117-
compileDir("compiler/src/dotty/tools/dotc/printing", picklingWithCompilerOptions) +
118-
compileDir("compiler/src/dotty/tools/repl", picklingWithCompilerOptions) +
119-
compileDir("compiler/src/dotty/tools/dotc/rewrites", picklingWithCompilerOptions) +
120-
compileDir("compiler/src/dotty/tools/dotc/transform", picklingWithCompilerOptions) +
121-
compileDir("compiler/src/dotty/tools/dotc/typer", picklingWithCompilerOptions) +
122-
compileDir("compiler/src/dotty/tools/dotc/util", picklingWithCompilerOptions) +
123-
compileDir("compiler/src/dotty/tools/io", picklingWithCompilerOptions) +
124-
compileFile("tests/pos/pickleinf.scala", picklingWithCompilerOptions) +
125-
compileDir("compiler/src/dotty/tools/dotc/core/classfile", picklingWithCompilerOptions) +
126-
compileDir("compiler/src/dotty/tools/dotc/core/tasty", picklingWithCompilerOptions) +
127-
compileDir("compiler/src/dotty/tools/dotc/core/unpickleScala2", picklingWithCompilerOptions)
128-
}.limitThreads(4).checkCompile()
116+
aggregateTests(
117+
compileDir("compiler/src/dotty/tools", picklingWithCompilerOptions, recursive = false),
118+
compileDir("compiler/src/dotty/tools/dotc", picklingWithCompilerOptions, recursive = false),
119+
compileDir("library/src/dotty/runtime", picklingWithCompilerOptions),
120+
compileFilesInDir("compiler/src/dotty/tools/backend/jvm", picklingWithCompilerOptions, jvmBackendFilter),
121+
compileDir("compiler/src/dotty/tools/dotc/ast", picklingWithCompilerOptions),
122+
compileDir("compiler/src/dotty/tools/dotc/core", picklingWithCompilerOptions, recursive = false),
123+
compileDir("compiler/src/dotty/tools/dotc/config", picklingWithCompilerOptions),
124+
compileDir("compiler/src/dotty/tools/dotc/parsing", picklingWithCompilerOptions),
125+
compileDir("compiler/src/dotty/tools/dotc/printing", picklingWithCompilerOptions),
126+
compileDir("compiler/src/dotty/tools/repl", picklingWithCompilerOptions),
127+
compileDir("compiler/src/dotty/tools/dotc/rewrites", picklingWithCompilerOptions),
128+
compileDir("compiler/src/dotty/tools/dotc/transform", picklingWithCompilerOptions),
129+
compileDir("compiler/src/dotty/tools/dotc/typer", picklingWithCompilerOptions),
130+
compileDir("compiler/src/dotty/tools/dotc/util", picklingWithCompilerOptions),
131+
compileDir("compiler/src/dotty/tools/io", picklingWithCompilerOptions),
132+
compileFile("tests/pos/pickleinf.scala", picklingWithCompilerOptions),
133+
compileDir("compiler/src/dotty/tools/dotc/core/classfile", picklingWithCompilerOptions),
134+
compileDir("compiler/src/dotty/tools/dotc/core/tasty", picklingWithCompilerOptions),
135+
compileDir("compiler/src/dotty/tools/dotc/core/unpickleScala2", picklingWithCompilerOptions)
136+
).limitThreads(4).checkCompile()
137+
}
129138

130139
@Test def testPlugins: Unit = {
131140
val pluginFile = "plugin.properties"

0 commit comments

Comments
 (0)