@@ -50,9 +50,25 @@ trait ParallelTesting extends RunnerOrchestration { self =>
50
50
private sealed trait TestSource { self =>
51
51
def name : String
52
52
def outDir : JFile
53
- def flags : TestFlags
53
+ def flags : Array [String ]
54
+
55
+ def classPath : String =
56
+ outDir.getAbsolutePath +
57
+ flags
58
+ .dropWhile(_ != " -classpath" )
59
+ .drop(1 )
60
+ .headOption
61
+ .map(" :" + _)
62
+ .getOrElse(" " )
54
63
55
- def runClassPath : String = outDir.getAbsolutePath + " :" + flags.runClassPath
64
+ def runClassPath = {
65
+ flags
66
+ .dropWhile(_ != " -YRunClasspath" )
67
+ .drop(1 )
68
+ .headOption
69
+ .map(outDir.getAbsolutePath + " :" + _)
70
+ .getOrElse(classPath)
71
+ }
56
72
57
73
def title : String = self match {
58
74
case self : JointCompilationSource =>
@@ -66,11 +82,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
66
82
/** Adds the flags specified in `newFlags0` if they do not already exist */
67
83
def withFlags (newFlags0 : String * ) = {
68
84
val newFlags = newFlags0.toArray
69
- if (! flags.options. containsSlice(newFlags)) self match {
85
+ if (! flags.containsSlice(newFlags)) self match {
70
86
case self : JointCompilationSource =>
71
- self.copy(flags = flags.and( newFlags:_* ) )
87
+ self.copy(flags = flags ++ newFlags)
72
88
case self : SeparateCompilationSource =>
73
- self.copy(flags = flags.and( newFlags:_* ) )
89
+ self.copy(flags = flags ++ newFlags)
74
90
}
75
91
else self
76
92
}
@@ -87,7 +103,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
87
103
|the test can be reproduced by running: """ .stripMargin
88
104
)
89
105
sb.append(" \n\n ./bin/dotc " )
90
- flags.all. foreach { arg =>
106
+ flags.foreach { arg =>
91
107
if (lineLen > maxLen) {
92
108
sb.append(" \\\n " )
93
109
lineLen = 4
@@ -131,7 +147,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
131
147
private final case class JointCompilationSource (
132
148
name : String ,
133
149
files : Array [JFile ],
134
- flags : TestFlags ,
150
+ flags : Array [ String ] ,
135
151
outDir : JFile
136
152
) extends TestSource {
137
153
def sourceFiles : Array [JFile ] = files.filter(isSourceFile)
@@ -145,7 +161,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
145
161
private final case class SeparateCompilationSource (
146
162
name : String ,
147
163
dir : JFile ,
148
- flags : TestFlags ,
164
+ flags : Array [ String ] ,
149
165
outDir : JFile
150
166
) extends TestSource {
151
167
@@ -326,9 +342,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
326
342
}
327
343
}
328
344
329
- protected def compile (files0 : Array [JFile ], flags0 : TestFlags , suppressErrors : Boolean , targetDir : JFile ): TestReporter = {
345
+ protected def compile (files0 : Array [JFile ], flags0 : Array [ String ] , suppressErrors : Boolean , targetDir : JFile ): TestReporter = {
330
346
331
- val flags = flags0 and (" -d" , targetDir.getAbsolutePath)
347
+ val flags = flags0 ++ Array (" -d" , targetDir.getAbsolutePath)
332
348
333
349
def flattenFiles (f : JFile ): Array [JFile ] =
334
350
if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
@@ -351,7 +367,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
351
367
" -encoding" , " UTF-8" ,
352
368
" -classpath" ,
353
369
s " .: ${Jars .scalaLibrary}: ${targetDir.getAbsolutePath}"
354
- ) ++ flags.all. takeRight(2 ) ++ fs
370
+ ) ++ flags.takeRight(2 ) ++ fs
355
371
356
372
val process = Runtime .getRuntime.exec(fullArgs)
357
373
val output = Source .fromInputStream(process.getErrorStream).mkString
@@ -379,7 +395,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
379
395
}
380
396
}
381
397
382
- val allArgs = addOutDir(flags.all )
398
+ val allArgs = addOutDir(flags)
383
399
384
400
// Compile with a try to catch any StackTrace generated by the compiler:
385
401
try {
@@ -1057,7 +1073,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1057
1073
}
1058
1074
1059
1075
/** Compiles a single file from the string path `f` using the supplied flags */
1060
- def compileFile (f : String , flags : TestFlags )(implicit outDirectory : String ): CompilationTest = {
1076
+ def compileFile (f : String , flags : Array [ String ] )(implicit outDirectory : String ): CompilationTest = {
1061
1077
val callingMethod = getCallingMethod()
1062
1078
val sourceFile = new JFile (f)
1063
1079
val parent = sourceFile.getParentFile
@@ -1087,7 +1103,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1087
1103
* By default, files are compiled in alphabetical order. An optional seed
1088
1104
* can be used for randomization.
1089
1105
*/
1090
- def compileDir (f : String , flags : TestFlags , randomOrder : Option [Int ] = None )(implicit outDirectory : String ): CompilationTest = {
1106
+ def compileDir (f : String , flags : Array [ String ] , randomOrder : Option [Int ] = None )(implicit outDirectory : String ): CompilationTest = {
1091
1107
val callingMethod = getCallingMethod()
1092
1108
val outDir = outDirectory + callingMethod + " /"
1093
1109
val sourceDir = new JFile (f)
@@ -1116,7 +1132,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1116
1132
* `testName` since files can be in separate directories and or be otherwise
1117
1133
* dissociated
1118
1134
*/
1119
- def compileList (testName : String , files : List [String ], flags : TestFlags , callingMethod : String = getCallingMethod())(implicit outDirectory : String ): CompilationTest = {
1135
+ def compileList (testName : String , files : List [String ], flags : Array [ String ] , callingMethod : String = getCallingMethod())(implicit outDirectory : String ): CompilationTest = {
1120
1136
val outDir = outDirectory + callingMethod + " /" + testName + " /"
1121
1137
1122
1138
// Directories in which to compile all containing files with `flags`:
@@ -1147,7 +1163,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1147
1163
* - Directories can have an associated check-file, where the check file has
1148
1164
* the same name as the directory (with the file extension `.check`)
1149
1165
*/
1150
- def compileFilesInDir (f : String , flags : TestFlags )(implicit outDirectory : String ): CompilationTest = {
1166
+ def compileFilesInDir (f : String , flags : Array [ String ] )(implicit outDirectory : String ): CompilationTest = {
1151
1167
val callingMethod = getCallingMethod()
1152
1168
val outDir = outDirectory + callingMethod + " /"
1153
1169
val sourceDir = new JFile (f)
@@ -1167,7 +1183,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1167
1183
* sub-directories and as such, does **not** perform separate compilation
1168
1184
* tests.
1169
1185
*/
1170
- def compileShallowFilesInDir (f : String , flags : TestFlags )(implicit outDirectory : String ): CompilationTest = {
1186
+ def compileShallowFilesInDir (f : String , flags : Array [ String ] )(implicit outDirectory : String ): CompilationTest = {
1171
1187
val callingMethod = getCallingMethod()
1172
1188
val outDir = outDirectory + callingMethod + " /"
1173
1189
val sourceDir = new JFile (f)
0 commit comments