diff options
Diffstat (limited to 'src/partest')
5 files changed, 62 insertions, 10 deletions
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala index 6a6a0662c5..336272ccb2 100644 --- a/src/partest/scala/tools/partest/PartestTask.scala +++ b/src/partest/scala/tools/partest/PartestTask.scala @@ -27,6 +27,9 @@ class PartestTask extends Task { def addConfiguredRunTests(input: FileSet): Unit = runFiles = Some(input) + def addConfiguredResidentTests(input: FileSet): Unit = + residentFiles = Some(input) + def setClasspath(input: Path): Unit = if (classpath.isEmpty) classpath = Some(input) @@ -55,6 +58,7 @@ class PartestTask extends Task { private var posFiles: Option[FileSet] = None private var negFiles: Option[FileSet] = None private var runFiles: Option[FileSet] = None + private var residentFiles: Option[FileSet] = None private def getPosFiles: Array[File] = if (!posFiles.isEmpty) { @@ -80,6 +84,14 @@ class PartestTask extends Task { else Array() + private def getResidentFiles: Array[File] = + if (!residentFiles.isEmpty) { + val files = residentFiles.get + (files.getDirectoryScanner(getProject).getIncludedFiles map { fs => new File(files.getDir(getProject), fs) }) + } + else + Array() + override def execute(): Unit = { @@ -157,7 +169,14 @@ class PartestTask extends Task { allFailures += failures } - if ((getPosFiles.size + getNegFiles.size + getRunFiles.size) == 0) + if (getResidentFiles.size > 0) { + log("Running resident compiler scenarii") + val (successes, failures) = runTestsForFiles(getResidentFiles, "res") + allSucesses += successes + allFailures += failures + } + + if ((getPosFiles.size + getNegFiles.size + getRunFiles.size + getResidentFiles.size) == 0) log("There where no tests to run.") else if (allFailures == 0) log("Test suite finished with no failures.") diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala index e68f3383b2..df7e2f78dc 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala @@ -64,6 +64,7 @@ else val bin = new File(PREFIX, "bin") if (dists.isDirectory) { + NestUI.verbose("Running on DISTRIBUTION") latestFile = prefixFile("dists/latest/bin") latestLibFile = prefixFile("dists/latest/lib/scala-library.jar") latestActFile = prefixFile("dists/latest/lib/scala-library.jar") @@ -71,7 +72,17 @@ else latestPartestFile = prefixFile("dists/latest/lib/scala-partest.jar") latestFjbgFile = prefixFile("lib/fjbg.jar") // starr } + else if (build.isDirectory && (new File(build, "quick/lib/scala-library.jar")).exists) { + NestUI.verbose("Running on SuperSABBUS QUICK") + latestFile = prefixFile("build/quick/bin") + latestLibFile = prefixFile("build/quick/lib/scala-library.jar") + latestActFile = prefixFile("build/quick/lib/scala-library.jar") + latestCompFile = prefixFile("build/quick/lib/scala-compiler.jar") + latestPartestFile = prefixFile("build/quick/lib/scala-partest.jar") + latestFjbgFile = prefixFile("lib/fjbg.jar") // starr + } else if (build.isDirectory) { + NestUI.verbose("Running on SABBUS QUICK") latestFile = prefixFile("build/quick/bin") latestLibFile = prefixFile("build/quick/lib/library") latestActFile = prefixFile("build/quick/lib/actors") @@ -80,6 +91,7 @@ else latestFjbgFile = prefixFile("lib/fjbg.jar") // starr } else if (bin.isDirectory) { + NestUI.verbose("Running on INSTALLED DIST") latestFile = prefixFile("bin") latestLibFile = prefixFile("lib/scala-library.jar") latestActFile = prefixFile("lib/scala-library.jar") diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala index e65012c4f3..4b06d677ac 100644 --- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala +++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala @@ -29,6 +29,12 @@ class ReflectiveRunner { latestFjbgFile.toURL) val sepLoader = new java.net.URLClassLoader(sepUrls, null) + val debug = System.getProperty("partest.debug", "false") equals "true" + if (debug) { + println("Loading classes from:") + sepUrls foreach { url => println(url) } + } + val sepRunnerClass = sepLoader.loadClass("scala.tools.partest.nest.ConsoleRunner") val sepRunner = sepRunnerClass.newInstance() @@ -39,11 +45,6 @@ class ReflectiveRunner { def main(args: String) { val cargs: Array[AnyRef] = Array(args) - val debug = System.getProperty("partest.debug", "false") equals "true" - if (debug) { - println("Loading classes from:") - sepUrls foreach { url => println(url) } - } sepMainMethod.invoke(sepRunner, cargs) } } diff --git a/src/partest/scala/tools/partest/nest/StreamAppender.scala b/src/partest/scala/tools/partest/nest/StreamAppender.scala index ffaa2dee53..62fd92b70d 100644 --- a/src/partest/scala/tools/partest/nest/StreamAppender.scala +++ b/src/partest/scala/tools/partest/nest/StreamAppender.scala @@ -74,11 +74,12 @@ object StreamAppender { } class StreamAppender(reader: BufferedReader, writer: PrintWriter) extends Runnable { - override def run() { + override def run() = runAndMap(identity) + def runAndMap(f:String=>String): Unit = { try { var line = reader.readLine() while (line != null) { - writer.println(line) + writer.println(f(line)) line = reader.readLine() } } catch { diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 8a9af3a29d..ff55d8f06b 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -272,9 +272,10 @@ class Worker(val fileManager: FileManager) extends Actor { case "pos" => for (file <- files) { runInContext(file, kind, (logFile: File, outDir: File) => { - if (!compileMgr.shouldCompile(file, kind, logFile)) + if (!compileMgr.shouldCompile(file, kind, logFile)) { NestUI.verbose("compilation of "+file+" failed\n") succeeded = false + } }) } case "neg" => @@ -352,6 +353,7 @@ class Worker(val fileManager: FileManager) extends Actor { // create compiler val settings = new Settings(error) settings.sourcepath.value = sourcepath + settings.classpath.value = fileManager.CLASSPATH reporter = new ConsoleReporter(settings, Console.in, logConsoleWriter) val command = new CompilerCommand(argList, settings, error, false) object compiler extends Global(command.settings, reporter) @@ -361,7 +363,7 @@ class Worker(val fileManager: FileManager) extends Actor { val resCompile = (line: String) => { NestUI.verbose("compiling "+line) - val cmdArgs = List.fromString(line, ' ') + val cmdArgs = List.fromString(line, ' ') map { fs => new File(dir, fs).getAbsolutePath } val sett = new Settings(error) sett.sourcepath.value = sourcepath val command = new CompilerCommand(cmdArgs, sett, error, true) @@ -388,6 +390,23 @@ class Worker(val fileManager: FileManager) extends Actor { System.setOut(oldStdOut) System.setErr(oldStdErr) + val tempLogFile = new File(dir, ".temp.log") + val logFileReader = new BufferedReader(new FileReader(logFile)) + val tempLogFilePrinter = new PrintWriter(tempLogFile) + val appender = + new StreamAppender(logFileReader, tempLogFilePrinter) + appender.runAndMap({ s => s.replaceAll(dir.getAbsolutePath.replace(File.separatorChar,'/')+File.separator, "") }) + logFileReader.close() + tempLogFilePrinter.close() + + val tempLogFileReader = new BufferedReader(new FileReader(tempLogFile)) + val logFilePrinter = new PrintWriter(logFile) + (new StreamAppender(tempLogFileReader, logFilePrinter)).run + tempLogFileReader.close() + logFilePrinter.close() + + tempLogFile.delete() + diff = compareOutput(dir, fileBase, kind, logFile) if (!diff.equals("")) { NestUI.verbose("output differs from log file\n") |