diff options
author | Philipp Haller <hallerp@gmail.com> | 2008-09-01 16:59:00 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2008-09-01 16:59:00 +0000 |
commit | e1cb4b5d15a1cc7c73d74a4c997aab45e394ba63 (patch) | |
tree | cf152da6b92844a18a5cc629c20ac5287da160c3 /src/partest | |
parent | 4b6277f8511bab6d4d0fc01f398bd9e967b94bdb (diff) | |
download | scala-e1cb4b5d15a1cc7c73d74a4c997aab45e394ba63.tar.gz scala-e1cb4b5d15a1cc7c73d74a4c997aab45e394ba63.tar.bz2 scala-e1cb4b5d15a1cc7c73d74a4c997aab45e394ba63.zip |
Adds check for latest jar/properties file to se...
Adds check for latest jar/properties file to select which build to run.
Fixes problem running quick build. Enables test directories for all
categories.
Diffstat (limited to 'src/partest')
3 files changed, 75 insertions, 37 deletions
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala index 8ddc0e2c47..0ae368c256 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala @@ -123,46 +123,92 @@ else latestCompFile = prefixFile(testBuild+"/lib/scala-compiler.jar") latestPartestFile = prefixFile(testBuild+"/lib/scala-partest.jar") } else { - val dists = new File(testParent, "dists") - val build = new File(testParent, "build") - // in case of an installed dist, testRootFile is one level deeper - val bin = new File(testParent.getParentFile, "bin") + def setupQuick() { + NestUI.verbose("Running build/quick") + latestFile = prefixFile("build/quick/bin") + latestLibFile = prefixFile("build/quick/classes/library") + latestActFile = prefixFile("build/quick/classes/library") + latestCompFile = prefixFile("build/quick/classes/compiler") + latestPartestFile = prefixFile("build/quick/classes/partest") + } - if (dists.isDirectory) { - NestUI.verbose("Running on DISTRIBUTION") + def setupInst() { + NestUI.verbose("Running dist (installed)") + val p = testParent.getParentFile + latestFile = prefixFileWith(p, "bin") + latestLibFile = prefixFileWith(p, "lib/scala-library.jar") + latestActFile = prefixFileWith(p, "lib/scala-library.jar") + latestCompFile = prefixFileWith(p, "lib/scala-compiler.jar") + latestPartestFile = prefixFileWith(p, "lib/scala-partest.jar") + } + + def setupDist() { + NestUI.verbose("Running dists/latest") latestFile = prefixFile("dists/latest/bin") latestLibFile = prefixFile("dists/latest/lib/scala-library.jar") latestActFile = prefixFile("dists/latest/lib/scala-library.jar") latestCompFile = prefixFile("dists/latest/lib/scala-compiler.jar") latestPartestFile = prefixFile("dists/latest/lib/scala-partest.jar") } - else if (build.isDirectory && (new File(build, "pack/lib/scala-library.jar")).exists) { - NestUI.verbose("Running on SuperSABBUS PACK") + + def setupPack() { + NestUI.verbose("Running build/pack") latestFile = prefixFile("build/pack/bin") latestLibFile = prefixFile("build/pack/lib/scala-library.jar") latestActFile = prefixFile("build/pack/lib/scala-library.jar") latestCompFile = prefixFile("build/pack/lib/scala-compiler.jar") latestPartestFile = prefixFile("build/pack/lib/scala-partest.jar") } - 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") - latestCompFile = prefixFile("build/quick/lib/compiler") - latestPartestFile = prefixFile("build/quick/lib/partest") - } - else if (bin.isDirectory) { - NestUI.verbose("Running on INSTALLED DIST") + + def max(a: Long, b: Long) = if (a > b) a else b + + val dists = new File(testParent, "dists") + val build = new File(testParent, "build") + // in case of an installed dist, testRootFile is one level deeper + val bin = new File(testParent.getParentFile, "bin") + + // detect most recent build + val quickTime = + max(prefixFile("build/quick/classes/compiler/compiler.properties").lastModified, + prefixFile("build/quick/classes/library/library.properties").lastModified) + val packTime = + max(prefixFile("build/pack/lib/scala-compiler.jar").lastModified, + prefixFile("build/pack/lib/scala-library.jar").lastModified) + val distTime = + max(prefixFile("dists/latest/lib/scala-compiler.jar").lastModified, + prefixFile("dists/latest/lib/scala-library.jar").lastModified) + val instTime = { val p = testParent.getParentFile - latestFile = prefixFileWith(p, "bin") - latestLibFile = prefixFileWith(p, "lib/scala-library.jar") - latestActFile = prefixFileWith(p, "lib/scala-library.jar") - latestCompFile = prefixFileWith(p, "lib/scala-compiler.jar") - latestPartestFile = prefixFileWith(p, "lib/scala-partest.jar") + max(prefixFileWith(p, "lib/scala-compiler.jar").lastModified, + prefixFileWith(p, "lib/scala-library.jar").lastModified) + } + + if (quickTime > packTime) { // pack ruled out + if (quickTime > distTime) { // dist ruled out + if (quickTime > instTime) // inst ruled out + setupQuick() + else + setupInst() + } else { // quick ruled out + if (distTime > instTime) // inst ruled out + setupDist() + else + setupInst() + } + } else { // quick ruled out + if (packTime > distTime) { // dist ruled out + if (packTime > instTime) // inst ruled out + setupPack() + else + setupInst() + } else { // pack ruled out + if (distTime > instTime) // inst ruled out + setupDist() + else + setupInst() + } } - else - error("Scala binaries could not be found") + latestFjbgFile = prefixFile("lib/fjbg.jar") } BIN_DIR = latestFile.getAbsolutePath @@ -249,6 +295,6 @@ else } def getFiles(kind: String, doCheck: Boolean): List[File] = - getFiles(kind, doCheck, Some((".scala", false))) + getFiles(kind, doCheck, Some((".scala", true))) } diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index 46fbfac122..d2f1c7b76e 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -10,8 +10,6 @@ package scala.tools.partest.nest import java.io.{File, PrintStream, FileOutputStream, BufferedReader, InputStreamReader, StringWriter, PrintWriter} -import scala.actors.Actor._ - class ConsoleRunner extends DirectRunner with RunnerUtils { var fileManager: ConsoleFileManager = _ @@ -180,8 +178,6 @@ class ConsoleRunner extends DirectRunner with RunnerUtils { if (check) { val kindFiles = if (kind == "res") //TODO: is there a nicer way? fileManager.getFiles(kind, check, Some((".res", false))) - else if (kind == "pos" || kind == "jvm") - fileManager.getFiles(kind, check, Some((".scala", true))) else fileManager.getFiles(kind, check) if (!kindFiles.isEmpty) { diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala index 7d150f72f5..7aec84a30e 100644 --- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala +++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala @@ -40,13 +40,9 @@ class ReflectiveRunner extends RunnerUtils { import fileManager.{latestCompFile, latestLibFile, latestActFile, latestPartestFile, latestFjbgFile} - val sepUrls = if (!classPath.isEmpty) - Array(latestCompFile.toURL, latestLibFile.toURL, - latestActFile.toURL, latestPartestFile.toURL, - latestFjbgFile.toURL) - else - Array(latestCompFile.toURL, latestLibFile.toURL, - latestActFile.toURL, latestPartestFile.toURL) + val sepUrls = Array(latestCompFile.toURL, latestLibFile.toURL, + latestActFile.toURL, latestPartestFile.toURL, + latestFjbgFile.toURL) val sepLoader = new java.net.URLClassLoader(sepUrls, null) |