@@ -58,7 +58,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
58
58
def flags : TestFlags
59
59
def sourceFiles : Array [JFile ]
60
60
61
- def runClassPath : String = outDir.getAbsolutePath + JFile .pathSeparator + flags.runClassPath
61
+ def runClassPath : String = outDir.getPath + JFile .pathSeparator + flags.runClassPath
62
62
63
63
def title : String = self match {
64
64
case self : JointCompilationSource =>
@@ -107,7 +107,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
107
107
108
108
self match {
109
109
case source : JointCompilationSource => {
110
- source.sourceFiles.map(_.getAbsolutePath ).foreach { path =>
110
+ source.sourceFiles.map(_.getPath ).foreach { path =>
111
111
sb.append(delimiter)
112
112
sb.append(path)
113
113
sb += ' '
@@ -217,10 +217,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
217
217
*/
218
218
final def checkFile (testSource : TestSource ): Option [JFile ] = (testSource match {
219
219
case ts : JointCompilationSource =>
220
- ts.files.collectFirst { case f if ! f.isDirectory => new JFile (f.getAbsolutePath .replaceFirst(" \\ .scala$" , " .check" )) }
220
+ ts.files.collectFirst { case f if ! f.isDirectory => new JFile (f.getPath .replaceFirst(" \\ .scala$" , " .check" )) }
221
221
222
222
case ts : SeparateCompilationSource =>
223
- Option (new JFile (ts.dir.getAbsolutePath + " .check" ))
223
+ Option (new JFile (ts.dir.getPath + " .check" ))
224
224
}).filter(_.exists)
225
225
226
226
/**
@@ -319,9 +319,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
319
319
if (! testFilter.isDefined) testSources
320
320
else testSources.filter {
321
321
case JointCompilationSource (_, files, _, _, _, _) =>
322
- files.exists(file => file.getAbsolutePath .contains(testFilter.get))
322
+ files.exists(file => file.getPath .contains(testFilter.get))
323
323
case SeparateCompilationSource (_, dir, _, _) =>
324
- dir.getAbsolutePath .contains(testFilter.get)
324
+ dir.getPath .contains(testFilter.get)
325
325
}
326
326
327
327
/** Total amount of test sources being compiled by this test */
@@ -423,9 +423,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
423
423
}
424
424
425
425
protected def compile (files0 : Array [JFile ], flags0 : TestFlags , suppressErrors : Boolean , targetDir : JFile ): TestReporter = {
426
-
427
- val flags = flags0.and(" -d" , targetDir.getAbsolutePath)
428
- .withClasspath(targetDir.getAbsolutePath)
426
+ val flags = flags0.and(" -d" , targetDir.getPath)
427
+ .withClasspath(targetDir.getPath)
429
428
430
429
def flattenFiles (f : JFile ): Array [JFile ] =
431
430
if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
@@ -469,10 +468,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
469
468
470
469
// If a test contains a Java file that cannot be parsed by Dotty's Java source parser, its
471
470
// name must contain the string "JAVA_ONLY".
472
- val dottyFiles = files.filterNot(_.getName.contains(" JAVA_ONLY" )).map(_.getAbsolutePath )
471
+ val dottyFiles = files.filterNot(_.getName.contains(" JAVA_ONLY" )).map(_.getPath )
473
472
driver.process(allArgs ++ dottyFiles, reporter = reporter)
474
473
475
- val javaFiles = files.filter(_.getName.endsWith(" .java" )).map(_.getAbsolutePath )
474
+ val javaFiles = files.filter(_.getName.endsWith(" .java" )).map(_.getPath )
476
475
val javaErrors = compileWithJavac(javaFiles)
477
476
478
477
if (javaErrors.isDefined) {
@@ -486,7 +485,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
486
485
protected def compileFromTasty (flags0 : TestFlags , suppressErrors : Boolean , targetDir : JFile ): TestReporter = {
487
486
val tastyOutput = new JFile (targetDir.getPath + " _from-tasty" )
488
487
tastyOutput.mkdir()
489
- val flags = flags0 and (" -d" , tastyOutput.getAbsolutePath ) and " -from-tasty"
488
+ val flags = flags0 and (" -d" , tastyOutput.getPath ) and " -from-tasty"
490
489
491
490
def tastyFileToClassName (f : JFile ): String = {
492
491
val pathStr = targetDir.toPath.relativize(f.toPath).toString.replace(JFile .separatorChar, '.' )
@@ -668,7 +667,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
668
667
Source .fromFile(file, " UTF-8" ).getLines().zipWithIndex.foreach { case (line, lineNbr) =>
669
668
val errors = line.sliding(" // error" .length).count(_.mkString == " // error" )
670
669
if (errors > 0 )
671
- errorMap.put(s " ${file.getAbsolutePath }: ${lineNbr}" , errors)
670
+ errorMap.put(s " ${file.getPath }: ${lineNbr}" , errors)
672
671
673
672
val noposErrors = line.sliding(" // nopos-error" .length).count(_.mkString == " // nopos-error" )
674
673
if (noposErrors > 0 ) {
@@ -686,7 +685,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
686
685
687
686
def getMissingExpectedErrors (errorMap : HashMap [String , Integer ], reporterErrors : Iterator [MessageContainer ]) = ! reporterErrors.forall { error =>
688
687
val key = if (error.pos.exists) {
689
- val fileName = error.pos.source.file.toString
688
+ def toRelative (path : String ): String = // For some reason, absolute paths leak from the compiler itself...
689
+ path.split(" /" ).dropWhile(_ != " tests" ).mkString(" /" )
690
+ val fileName = toRelative(error.pos.source.file.toString)
690
691
s " $fileName: ${error.pos.line}"
691
692
692
693
} else " nopos"
@@ -938,7 +939,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
938
939
* and if so copying recursively
939
940
*/
940
941
private def copyToDir (dir : JFile , file : JFile ): JFile = {
941
- val target = Paths .get(dir.getAbsolutePath , file.getName)
942
+ val target = Paths .get(dir.getPath , file.getName)
942
943
Files .copy(file.toPath, target, REPLACE_EXISTING )
943
944
if (file.isDirectory) file.listFiles.map(copyToDir(target.toFile, _))
944
945
target.toFile
@@ -1216,7 +1217,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1216
1217
val (dirs, files) = compilationTargets(sourceDir, fromTastyFilter)
1217
1218
1218
1219
val filteredFiles = testFilter match {
1219
- case Some (str) => files.filter(_.getAbsolutePath .contains(str))
1220
+ case Some (str) => files.filter(_.getPath .contains(str))
1220
1221
case None => files
1221
1222
}
1222
1223
0 commit comments