@@ -4,26 +4,27 @@ package dotc
4
4
5
5
import org .junit .Test
6
6
import java .io .{ File => JFile }
7
-
8
7
import org .junit .experimental .categories .Category
9
8
9
+ import scala .util .matching .Regex
10
+
10
11
@ Category (Array (classOf [ParallelTesting ]))
11
12
class CompilationTests extends ParallelTesting {
12
13
import CompilationTests ._
13
14
14
- def interactive : Boolean = ! sys.env.contains(" DRONE" )
15
+ def isInteractive : Boolean = ! sys.env.contains(" DRONE" )
15
16
16
- def regex : Option [String ] = sys.props.get(" dotty.partest.filter" )
17
+ def testFilter : Option [Regex ] = sys.props.get(" dotty.partest.filter" ).map(r => new Regex (r) )
17
18
18
19
// Positive tests ------------------------------------------------------------
19
20
20
21
@ Test def compilePos : Unit = {
21
22
compileList(" compileStdLib" , StdLibSources .whitelisted, scala2Mode.and(" -migration" , " -Yno-inline" )) +
22
23
compileFilesInDir(" ../tests/pos" , defaultOptions)
23
- }.pos ()
24
+ }.checkCompile ()
24
25
25
26
@ Test def compilePosScala2 : Unit =
26
- compileFilesInDir(" ../tests/pos-scala2" , scala2Mode).pos ()
27
+ compileFilesInDir(" ../tests/pos-scala2" , scala2Mode).checkCompile ()
27
28
28
29
@ Test def compilePosMixedFlags : Unit = {
29
30
compileFile(" ../tests/pos/nullarify.scala" , defaultOptions.and(" -Ycheck:nullarify" )) +
@@ -56,10 +57,10 @@ class CompilationTests extends ParallelTesting {
56
57
),
57
58
scala2Mode
58
59
)
59
- }.pos ()
60
+ }.checkCompile ()
60
61
61
62
@ Test def compileCoreNoCheck : Unit =
62
- compileDir(" ../compiler/src/dotty/tools/dotc/core" , noCheckOptions ++ classPath).pos ()
63
+ compileDir(" ../compiler/src/dotty/tools/dotc/core" , noCheckOptions ++ classPath).checkCompile ()
63
64
64
65
@ Test def compileDotcInternals : Unit = {
65
66
compileDir(" ../compiler/src/dotty/tools/dotc/ast" , defaultOptions) +
@@ -72,7 +73,7 @@ class CompilationTests extends ParallelTesting {
72
73
compileDir(" ../compiler/src/dotty/tools/dotc/typer" , defaultOptions) +
73
74
compileDir(" ../compiler/src/dotty/tools/dotc/util" , defaultOptions) +
74
75
compileDir(" ../compiler/src/dotty/tools/io" , defaultOptions)
75
- }.pos ()
76
+ }.checkCompile ()
76
77
77
78
@ Test def posTwice : Unit = {
78
79
compileFile(" ../tests/pos/Labels.scala" , defaultOptions) +
@@ -128,17 +129,17 @@ class CompilationTests extends ParallelTesting {
128
129
),
129
130
defaultOptions.and(" -Xprompt" )
130
131
)
131
- }.times(2 ).pos ()
132
+ }.times(2 ).checkCompile ()
132
133
133
134
// New tests -----------------------------------------------------------------
134
135
135
136
@ Test def compileNew : Unit =
136
- compileFilesInDir(" ../tests/new" , defaultOptions).pos ()
137
+ compileFilesInDir(" ../tests/new" , defaultOptions).checkCompile ()
137
138
138
139
// Negative tests ------------------------------------------------------------
139
140
140
141
@ Test def compileNeg : Unit =
141
- compileShallowFilesInDir(" ../tests/neg" , defaultOptions).neg ()
142
+ compileShallowFilesInDir(" ../tests/neg" , defaultOptions).checkExpectedErrors ()
142
143
143
144
@ Test def compileNegCustomFlags : Unit = {
144
145
compileFile(" ../tests/neg/customArgs/typers.scala" , allowDoubleBindings) +
@@ -157,14 +158,17 @@ class CompilationTests extends ParallelTesting {
157
158
compileFile(" ../tests/neg/tailcall/tailrec-2.scala" , defaultOptions) +
158
159
compileFile(" ../tests/neg/tailcall/tailrec-3.scala" , defaultOptions) +
159
160
compileDir(" ../tests/neg/typedIdents" , defaultOptions)
160
- }.neg ()
161
+ }.checkExpectedErrors ()
161
162
162
163
// Run tests -----------------------------------------------------------------
163
164
164
165
@ Test def runAll : Unit =
165
- compileFilesInDir(" ../tests/run" , defaultOptions).run ()
166
+ compileFilesInDir(" ../tests/run" , defaultOptions).checkRuns ()
166
167
167
168
// Pickling Tests ------------------------------------------------------------
169
+ //
170
+ // Pickling tests are very memory intensive and as such need to be run with a
171
+ // lower level of concurrency as to not kill their running VMs
168
172
169
173
@ Test def testPickling1 : Unit = {
170
174
compileFilesInDir(" ../tests/new" , picklingOptions) +
@@ -183,21 +187,21 @@ class CompilationTests extends ParallelTesting {
183
187
compileDir(" ../compiler/src/dotty/tools/dotc/util" , picklingOptions) +
184
188
compileDir(" ../compiler/src/dotty/tools/io" , picklingOptions) +
185
189
compileFile(" ../tests/pos/pickleinf.scala" , picklingOptions)
186
- }.limitThreads(4 ).pos ()
190
+ }.limitThreads(4 ).checkCompile ()
187
191
188
192
@ Test def testPickling2 : Unit = {
189
193
compileDir(" ../compiler/src/dotty/tools/dotc/core/classfile" , picklingOptions) +
190
194
compileDir(" ../compiler/src/dotty/tools/dotc/core/tasty" , picklingOptions) +
191
195
compileDir(" ../compiler/src/dotty/tools/dotc/core/unpickleScala2" , picklingOptions)
192
- }.limitThreads(4 ).pos ()
196
+ }.limitThreads(4 ).checkCompile ()
193
197
194
198
@ Test def testPickling3 : Unit = {
195
199
compileDir(" ../compiler/src/dotty/tools" , picklingOptions)
196
- }.limitThreads(4 ).pos ()
200
+ }.limitThreads(4 ).checkCompile ()
197
201
198
202
@ Test def testPickling4 : Unit = {
199
203
compileDir(" ../compiler/src/dotty/tools/dotc" , picklingOptions)
200
- }.limitThreads(4 ).pos ()
204
+ }.limitThreads(4 ).checkCompile ()
201
205
202
206
/** The purpose of this test is two-fold, being able to compile dotty
203
207
* bootstrapped, and making sure that TASTY can link against a compiled
@@ -239,7 +243,7 @@ class CompilationTests extends ParallelTesting {
239
243
compileShallowFilesInDir(" ../compiler/src/dotty/tools/dotc/typer" , opt) +
240
244
compileShallowFilesInDir(" ../compiler/src/dotty/tools/dotc/util" , opt)
241
245
} :: Nil
242
- }.map(_.pos ()).foreach(_.delete())
246
+ }.map(_.checkCompile ()).foreach(_.delete())
243
247
}
244
248
}
245
249
0 commit comments