@@ -50,9 +50,25 @@ trait ParallelTesting extends RunnerOrchestration { self =>
5050 private sealed trait TestSource { self =>
5151 def name : String
5252 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(" " )
5463
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+ }
5672
5773 def title : String = self match {
5874 case self : JointCompilationSource =>
@@ -66,11 +82,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
6682 /** Adds the flags specified in `newFlags0` if they do not already exist */
6783 def withFlags (newFlags0 : String * ) = {
6884 val newFlags = newFlags0.toArray
69- if (! flags.options. containsSlice(newFlags)) self match {
85+ if (! flags.containsSlice(newFlags)) self match {
7086 case self : JointCompilationSource =>
71- self.copy(flags = flags.and( newFlags:_* ) )
87+ self.copy(flags = flags ++ newFlags)
7288 case self : SeparateCompilationSource =>
73- self.copy(flags = flags.and( newFlags:_* ) )
89+ self.copy(flags = flags ++ newFlags)
7490 }
7591 else self
7692 }
@@ -87,7 +103,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
87103 |the test can be reproduced by running: """ .stripMargin
88104 )
89105 sb.append(" \n\n ./bin/dotc " )
90- flags.all. foreach { arg =>
106+ flags.foreach { arg =>
91107 if (lineLen > maxLen) {
92108 sb.append(" \\\n " )
93109 lineLen = 4
@@ -131,7 +147,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
131147 private final case class JointCompilationSource (
132148 name : String ,
133149 files : Array [JFile ],
134- flags : TestFlags ,
150+ flags : Array [ String ] ,
135151 outDir : JFile
136152 ) extends TestSource {
137153 def sourceFiles : Array [JFile ] = files.filter(isSourceFile)
@@ -145,7 +161,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
145161 private final case class SeparateCompilationSource (
146162 name : String ,
147163 dir : JFile ,
148- flags : TestFlags ,
164+ flags : Array [ String ] ,
149165 outDir : JFile
150166 ) extends TestSource {
151167
@@ -326,9 +342,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
326342 }
327343 }
328344
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 = {
330346
331- val flags = flags0 and (" -d" , targetDir.getAbsolutePath)
347+ val flags = flags0 ++ Array (" -d" , targetDir.getAbsolutePath)
332348
333349 def flattenFiles (f : JFile ): Array [JFile ] =
334350 if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
@@ -351,7 +367,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
351367 " -encoding" , " UTF-8" ,
352368 " -classpath" ,
353369 s " .: ${Jars .scalaLibrary}: ${targetDir.getAbsolutePath}"
354- ) ++ flags.all. takeRight(2 ) ++ fs
370+ ) ++ flags.takeRight(2 ) ++ fs
355371
356372 val process = Runtime .getRuntime.exec(fullArgs)
357373 val output = Source .fromInputStream(process.getErrorStream).mkString
@@ -379,7 +395,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
379395 }
380396 }
381397
382- val allArgs = addOutDir(flags.all )
398+ val allArgs = addOutDir(flags)
383399
384400 // Compile with a try to catch any StackTrace generated by the compiler:
385401 try {
@@ -1057,7 +1073,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10571073 }
10581074
10591075 /** 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 = {
10611077 val callingMethod = getCallingMethod()
10621078 val sourceFile = new JFile (f)
10631079 val parent = sourceFile.getParentFile
@@ -1087,7 +1103,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10871103 * By default, files are compiled in alphabetical order. An optional seed
10881104 * can be used for randomization.
10891105 */
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 = {
10911107 val callingMethod = getCallingMethod()
10921108 val outDir = outDirectory + callingMethod + " /"
10931109 val sourceDir = new JFile (f)
@@ -1116,7 +1132,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11161132 * `testName` since files can be in separate directories and or be otherwise
11171133 * dissociated
11181134 */
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 = {
11201136 val outDir = outDirectory + callingMethod + " /" + testName + " /"
11211137
11221138 // Directories in which to compile all containing files with `flags`:
@@ -1147,7 +1163,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11471163 * - Directories can have an associated check-file, where the check file has
11481164 * the same name as the directory (with the file extension `.check`)
11491165 */
1150- def compileFilesInDir (f : String , flags : TestFlags )(implicit outDirectory : String ): CompilationTest = {
1166+ def compileFilesInDir (f : String , flags : Array [ String ] )(implicit outDirectory : String ): CompilationTest = {
11511167 val callingMethod = getCallingMethod()
11521168 val outDir = outDirectory + callingMethod + " /"
11531169 val sourceDir = new JFile (f)
@@ -1167,7 +1183,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
11671183 * sub-directories and as such, does **not** perform separate compilation
11681184 * tests.
11691185 */
1170- def compileShallowFilesInDir (f : String , flags : TestFlags )(implicit outDirectory : String ): CompilationTest = {
1186+ def compileShallowFilesInDir (f : String , flags : Array [ String ] )(implicit outDirectory : String ): CompilationTest = {
11711187 val callingMethod = getCallingMethod()
11721188 val outDir = outDirectory + callingMethod + " /"
11731189 val sourceDir = new JFile (f)
0 commit comments