@@ -58,7 +58,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
5858 def flags : TestFlags
5959 def sourceFiles : Array [JFile ]
6060
61- def runClassPath : String = outDir.getAbsolutePath + JFile .pathSeparator + flags.runClassPath
61+ def runClassPath : String = outDir.getPath + JFile .pathSeparator + flags.runClassPath
6262
6363 def title : String = self match {
6464 case self : JointCompilationSource =>
@@ -107,7 +107,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
107107
108108 self match {
109109 case source : JointCompilationSource => {
110- source.sourceFiles.map(_.getAbsolutePath ).foreach { path =>
110+ source.sourceFiles.map(_.getPath ).foreach { path =>
111111 sb.append(delimiter)
112112 sb.append(path)
113113 sb += ' '
@@ -217,10 +217,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
217217 */
218218 final def checkFile (testSource : TestSource ): Option [JFile ] = (testSource match {
219219 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" )) }
221221
222222 case ts : SeparateCompilationSource =>
223- Option (new JFile (ts.dir.getAbsolutePath + " .check" ))
223+ Option (new JFile (ts.dir.getPath + " .check" ))
224224 }).filter(_.exists)
225225
226226 /**
@@ -319,9 +319,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
319319 if (! testFilter.isDefined) testSources
320320 else testSources.filter {
321321 case JointCompilationSource (_, files, _, _, _, _) =>
322- files.exists(file => file.getAbsolutePath .contains(testFilter.get))
322+ files.exists(file => file.getPath .contains(testFilter.get))
323323 case SeparateCompilationSource (_, dir, _, _) =>
324- dir.getAbsolutePath .contains(testFilter.get)
324+ dir.getPath .contains(testFilter.get)
325325 }
326326
327327 /** Total amount of test sources being compiled by this test */
@@ -423,9 +423,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
423423 }
424424
425425 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)
429428
430429 def flattenFiles (f : JFile ): Array [JFile ] =
431430 if (f.isDirectory) f.listFiles.flatMap(flattenFiles)
@@ -469,10 +468,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
469468
470469 // If a test contains a Java file that cannot be parsed by Dotty's Java source parser, its
471470 // 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 )
473472 driver.process(allArgs ++ dottyFiles, reporter = reporter)
474473
475- val javaFiles = files.filter(_.getName.endsWith(" .java" )).map(_.getAbsolutePath )
474+ val javaFiles = files.filter(_.getName.endsWith(" .java" )).map(_.getPath )
476475 val javaErrors = compileWithJavac(javaFiles)
477476
478477 if (javaErrors.isDefined) {
@@ -486,7 +485,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
486485 protected def compileFromTasty (flags0 : TestFlags , suppressErrors : Boolean , targetDir : JFile ): TestReporter = {
487486 val tastyOutput = new JFile (targetDir.getPath + " _from-tasty" )
488487 tastyOutput.mkdir()
489- val flags = flags0 and (" -d" , tastyOutput.getAbsolutePath ) and " -from-tasty"
488+ val flags = flags0 and (" -d" , tastyOutput.getPath ) and " -from-tasty"
490489
491490 def tastyFileToClassName (f : JFile ): String = {
492491 val pathStr = targetDir.toPath.relativize(f.toPath).toString.replace(JFile .separatorChar, '.' )
@@ -668,7 +667,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
668667 Source .fromFile(file, " UTF-8" ).getLines().zipWithIndex.foreach { case (line, lineNbr) =>
669668 val errors = line.sliding(" // error" .length).count(_.mkString == " // error" )
670669 if (errors > 0 )
671- errorMap.put(s " ${file.getAbsolutePath }: ${lineNbr}" , errors)
670+ errorMap.put(s " ${file.getPath }: ${lineNbr}" , errors)
672671
673672 val noposErrors = line.sliding(" // nopos-error" .length).count(_.mkString == " // nopos-error" )
674673 if (noposErrors > 0 ) {
@@ -686,7 +685,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
686685
687686 def getMissingExpectedErrors (errorMap : HashMap [String , Integer ], reporterErrors : Iterator [MessageContainer ]) = ! reporterErrors.forall { error =>
688687 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)
690691 s " $fileName: ${error.pos.line}"
691692
692693 } else " nopos"
@@ -938,7 +939,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
938939 * and if so copying recursively
939940 */
940941 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)
942943 Files .copy(file.toPath, target, REPLACE_EXISTING )
943944 if (file.isDirectory) file.listFiles.map(copyToDir(target.toFile, _))
944945 target.toFile
@@ -1216,7 +1217,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
12161217 val (dirs, files) = compilationTargets(sourceDir, fromTastyFilter)
12171218
12181219 val filteredFiles = testFilter match {
1219- case Some (str) => files.filter(_.getAbsolutePath .contains(str))
1220+ case Some (str) => files.filter(_.getPath .contains(str))
12201221 case None => files
12211222 }
12221223
0 commit comments