summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2008-02-01 18:54:49 +0000
committerPhilipp Haller <hallerp@gmail.com>2008-02-01 18:54:49 +0000
commitd45f68252a9922f590e8cab5f4236c3d113d56df (patch)
treed8dd13de0d8a4f8b9573413d1d6d478cd63b510d
parent1bb174dd34747868dd49184a9e2ef93d9ba274e4 (diff)
downloadscala-d45f68252a9922f590e8cab5f4236c3d113d56df.tar.gz
scala-d45f68252a9922f590e8cab5f4236c3d113d56df.tar.bz2
scala-d45f68252a9922f590e8cab5f4236c3d113d56df.zip
Added initial re-write of partest
-rw-r--r--src/partest/scala/tools/partest/nest/CompileManager.scala126
-rw-r--r--src/partest/scala/tools/partest/nest/FileManager.scala141
-rw-r--r--src/partest/scala/tools/partest/nest/NestRunner.scala86
-rw-r--r--src/partest/scala/tools/partest/nest/NestUI.scala69
-rw-r--r--src/partest/scala/tools/partest/nest/TestFile.scala77
-rw-r--r--src/partest/scala/tools/partest/nest/Worker.scala169
6 files changed, 668 insertions, 0 deletions
diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala
new file mode 100644
index 0000000000..b96078aa26
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/CompileManager.scala
@@ -0,0 +1,126 @@
+/* NEST (New Scala Test)
+ * @author Philipp Haller
+ */
+
+package scala.tools.partest.nest
+
+import scala.tools.nsc.{Global, Settings}
+import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
+
+import java.io.{File, BufferedReader, PrintWriter, FileWriter}
+import java.net.URLClassLoader
+
+class ExtConsoleReporter(override val settings: Settings, reader: BufferedReader, var writer: PrintWriter) extends ConsoleReporter(settings, reader, writer) {
+ def this(settings: Settings) = {
+ this(settings, Console.in, new PrintWriter(new FileWriter("/dev/null")))
+ }
+ def hasWarnings: Boolean = WARNING.count != 0
+}
+
+abstract class SimpleCompiler {
+ def compile(file: File, kind: String): Boolean
+}
+
+class DirectCompiler extends SimpleCompiler {
+ def newGlobal(settings: Settings, reporter: Reporter): Global =
+ new Global(settings, reporter)
+
+ def newGlobal(settings: Settings, log: File): Global = {
+ val rep = new ExtConsoleReporter(new Settings(x => ()),
+ Console.in,
+ new PrintWriter(new FileWriter(log)))
+ rep.shortname = true
+ newGlobal(settings, rep)
+ }
+
+ def newSettings = {
+ val settings = new Settings(x => ())
+ settings.deprecation.value = true
+ settings.nowarnings.value = false
+ settings.encoding.value = "iso-8859-1"
+ settings
+ }
+
+ def newReporter(sett: Settings) = new ExtConsoleReporter(sett,
+ Console.in,
+ new PrintWriter(new FileWriter("/home/phaller/svn/scala3/test/scalac-out")))
+
+ val testSettings = newSettings
+ val testRep = newReporter(testSettings)
+ val global = newGlobal(testSettings, testRep)
+
+ def compile(file: File, kind: String): Boolean = {
+ val test: TestFile = kind match {
+ case "pos" => PosTestFile(file)
+ case "neg" => NegTestFile(file)
+ case "run" => RunTestFile(file)
+ case "jvm" => JvmTestFile(file)
+ case "shootout" => ShootoutTestFile(file)
+ }
+ test.defineSettings(testSettings)
+
+ val toCompile = List(file.getPath)
+ try {
+ println(global + " compiling " + toCompile)
+ (new global.Run) compile toCompile
+ testRep.printSummary
+ testRep.writer.flush
+ testRep.writer.close
+ println(global + " finished compiling " + file)
+ println(this+" errors: "+testRep.hasErrors)
+ } catch {
+ case e: Exception =>
+ e.printStackTrace()
+ false
+ }
+ !testRep.hasErrors
+ }
+}
+
+class ReflectiveCompiler extends SimpleCompiler {
+ val nscDir =
+ new File("/home/phaller/svn/scala3/build/quick/lib/compiler/")
+ val parTestDir =
+ new File("/home/phaller/svn/scala3/build/quick/lib/partest/")
+
+ val sepUrls = Array(nscDir.toURL, parTestDir.toURL)
+ val sepLoader = new URLClassLoader(sepUrls)
+
+ val sepCompilerClass =
+ sepLoader.loadClass("scala.tools.partest.nest.DirectCompiler")
+ // needed for reflective invocation
+ val fileClass = Class.forName("java.io.File")
+ val stringClass = Class.forName("java.lang.String")
+ val sepCompileMethod =
+ sepCompilerClass.getMethod("compile", Array(fileClass, stringClass))
+ val sepCompiler = sepCompilerClass.newInstance()
+
+ def compile(file: File, kind: String): Boolean = {
+ val fileArgs: Array[AnyRef] = Array(file, kind)
+ val res = sepCompileMethod.invoke(sepCompiler, fileArgs).asInstanceOf[java.lang.Boolean]
+ res.booleanValue()
+ }
+}
+
+class CompileManager {
+ var compiler: SimpleCompiler = new ReflectiveCompiler
+
+ var numSeparateCompilers = 1
+ def createSeparateCompiler() = {
+ numSeparateCompilers += 1
+ compiler = new ReflectiveCompiler
+ }
+
+ def shouldCompile(file: File, kind: String): Boolean =
+ compiler.compile(file, kind) || {
+ NestUI.verbose("creating new separate compiler")
+ createSeparateCompiler()
+ compiler.compile(file, kind)
+ }
+
+ def shouldFailCompile(file: File, kind: String): Boolean = {
+ // always create separate compiler
+ createSeparateCompiler()
+ !compiler.compile(file, kind)
+ }
+}
diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala
new file mode 100644
index 0000000000..19f29b3e73
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/FileManager.scala
@@ -0,0 +1,141 @@
+/* NEST (New Scala Test)
+ * @author Philipp Haller
+ */
+
+package scala.tools.partest.nest
+
+import java.io.{File, FilenameFilter}
+import java.net.URI
+
+object FileManager {
+
+ val PATH_SEP = File.pathSeparatorChar
+ val CLASSPATH = System.getProperty("java.class.path", ".")
+ val PREFIX = System.getProperty("user.dir", ".")+"/.."
+ val JAVACMD = "java" //TODO: detect
+
+/*
+if [ -d "$PREFIX/test" ]; then
+ TESTROOT="$PREFIX/test";
+elif [ -d "$PREFIX/misc/scala-test" ]; then
+ TESTROOT="$PREFIX/misc/scala-test";
+else
+ abort "Test directory not found";
+*/
+ val TESTROOT = {
+ val test = new File(PREFIX, "test")
+ val scala_test = new File(PREFIX, "misc/scala-test")
+ val testroot =
+ if (test.exists && test.isDirectory)
+ test
+ else if (scala_test.exists && scala_test.isDirectory)
+ scala_test
+ else
+ error("Test directory not found")
+ testroot.getAbsolutePath
+ }
+ val EXT_CLASSPATH = {
+ val libs = new File(TESTROOT, "files/lib")
+ // add all jars in libs to EXT_CLASSPATH
+ (libs.listFiles(new FilenameFilter {
+ def accept(dir: File, name: String) =
+ name.endsWith(".jar")
+ }) map {file => file.getAbsolutePath}).mkString(""+PATH_SEP)
+ }
+
+/*
+if [ -d "$PREFIX/dists" ]; then
+ LATEST="$PREFIX/dists/latest/bin";
+ LATEST_LIB="$PREFIX/dists/latest/lib/scala-library.jar";
+ LATEST_COMP="$PREFIX/dists/latest/lib/scala-compiler.jar";
+ LATEST_PREDEF="$PREFIX/dists/latest/lib/predef.dll";
+ LATEST_CLDC=$QUICK_CLDC;
+ LATEST_CLDCAPI=$QUICK_CLDCAPI;
+elif [ -d "$PREFIX/build" ]; then
+ LATEST="$QUICK";
+ LATEST_LIB=$QUICK_LIB;
+ LATEST_COMP=$QUICK_COMP;
+ LATEST_ACT=$QUICK_ACT;
+ LATEST_PREDEF=$QUICK_PREDEF;
+ LATEST_CLDC=$QUICK_CLDC;
+ LATEST_CLDCAPI=$QUICK_CLDCAPI;
+elif [ -d "$PREFIX/bin" ]; then
+ LATEST="$PREFIX/bin";
+ LATEST_LIB="$PREFIX/lib/scala-library.jar";
+ LATEST_COMP="$PREFIX/lib/scala-compiler.jar";
+ LATEST_PREDEF="$PREFIX/lib/predef.dll";
+ LATEST_CLDC="$PREFIX/lib/scalaapi10-unverified.jar";
+ LATEST_CLDCAPI="$PREFIX/lib/scalaapi10.jar";
+*/
+ val LATEST_LIB = {
+ NestUI.verbose("PREFIX: "+PREFIX)
+ val dists = new File(PREFIX, "dists")
+ val build = new File(PREFIX, "build")
+ val bin = new File(PREFIX, "bin")
+ val latest_lib: File =
+ if (dists.exists && dists.isDirectory)
+ new File(PREFIX, "dists/latest/lib/scala-library.jar")
+ else if (build.exists && build.isDirectory)
+ new File(PREFIX, "build/quick/lib/library")
+ else if (bin.exists && bin.isDirectory)
+ new File(PREFIX, "lib/scala-library.jar")
+ else
+ error("Scala binaries could not be found")
+ latest_lib.getAbsolutePath
+ }
+}
+
+class FileManager {
+
+ val srcDir = {
+ val dirname = System.getProperty("scalatest.cwd", "")
+ val dir = if (dirname.isEmpty) { // guess
+ val libDir = new File(new URI(classOf[Test].getResource("/").toString))
+ val path = libDir.getAbsolutePath
+ val parent = libDir.getParentFile
+ val rootDir =
+ if (path contains "quick") parent.getParentFile.getParentFile.getParentFile
+ else if (path contains "dists") parent.getParentFile.getParentFile
+ else parent
+ new File(rootDir, "test" + File.separator + "files")
+ } else
+ new File(dirname)
+ dir
+ }
+
+ if (!srcDir.isDirectory) {
+ NestUI.failure("Test directory \"" + srcDir.getAbsolutePath + "\" not found")
+ exit(1)
+ } else {
+ NestUI.verbose(srcDir.getAbsolutePath)
+ }
+
+ var testFiles: List[File] = List()
+
+ def getFiles(kind: String, doCheck: Boolean): List[File] = {
+ val filter = new FilenameFilter {
+ def accept(dir: File, name: String): Boolean = name endsWith ".scala"
+ }
+ val dir = new File(srcDir, kind)
+ if (dir.isDirectory) {
+ if (!testFiles.isEmpty) {
+ val dirpath = dir.getAbsolutePath
+ testFiles filter { _.getParentFile.getAbsolutePath == dirpath }
+ } else if (doCheck)
+ dir.listFiles(filter).toList
+ else // skip
+ Nil
+ } else {
+ NestUI.failure("Directory \"" + dir.getPath + "\" not found")
+ Nil
+ }
+ }
+
+ def deleteRecursive(dir: File) {
+ if (dir.isDirectory) {
+ for (file <- dir.list) deleteRecursive(new File(dir, file))
+ }
+ dir.delete
+ }
+
+}
diff --git a/src/partest/scala/tools/partest/nest/NestRunner.scala b/src/partest/scala/tools/partest/nest/NestRunner.scala
new file mode 100644
index 0000000000..ea75c94f7c
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/NestRunner.scala
@@ -0,0 +1,86 @@
+/* NEST (New Scala Test)
+ * @author Philipp Haller
+ */
+
+package scala.tools.partest.nest
+
+import java.io.{File, PrintStream, FileOutputStream}
+
+object NestRunner {
+ private val version = System.getProperty("java.version", "")
+ private val isJava5 = version matches "1.[5|6|7].*"
+
+ private var posCheck = false
+ private var negCheck = false
+ private var jvmCheck = false
+ private var runCheck = false
+ private var shootoutCheck = false
+
+ private var conservative = false
+
+ private var testFiles: List[File] = List()
+ private val con = new PrintStream(Console.out)
+ private var out = con
+
+ def main(args: Array[String]) {
+ NestUI.initialize(NestUI.MANY)
+
+ if (args.length == 0)
+ NestUI.usage()
+ else {
+ for (arg <- args) {
+ arg match {
+ case "--pos" => posCheck = true
+ case "--neg" => negCheck = true
+ case "--jvm" => jvmCheck = true
+ case "--run" => runCheck = true
+ case "--shootout" => shootoutCheck = true
+ case "--conservative" => conservative = true
+ case "--verbose" => NestUI._verbose = true
+ case "--version" => //todo: printVersion
+ case _ =>
+ if (arg endsWith ".scala") {
+ val file = new File(arg)
+ if (file.isFile)
+ testFiles = file :: testFiles
+ else {
+ NestUI.failure("File \"" + arg + "\" not found")
+ exit(1)
+ }
+ } else if (out eq con) {
+ val file = new File(arg)
+ if (file.isFile || file.createNewFile)
+ out = new PrintStream(new FileOutputStream(file))
+ else {
+ NestUI.failure("Result file \"" + arg + "\" not found")
+ exit(1)
+ }
+ } else
+ NestUI.usage()
+ }
+ }
+ go()
+ }
+ }
+
+ def runTests(kind: String, check: Boolean, msg: String) {
+ if (check) {
+ val fileMgr = new FileManager
+ val kindFiles =
+ if (!testFiles.isEmpty) testFiles
+ else fileMgr.getFiles(kind, check)
+ if (!kindFiles.isEmpty) {
+ NestUI.outline("\n"+msg+"\n")
+ val worker = new Worker
+ worker.runTests(kind, kindFiles)
+ }
+ }
+ }
+
+ def go() {
+ runTests("pos", posCheck, "Testing compiler (on files whose compilation should succeed)")
+ runTests("run", runCheck, "Testing JVM backend")
+ runTests("jvm", jvmCheck, "Testing JVM backend")
+ }
+
+}
diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala
new file mode 100644
index 0000000000..ff68c0d90f
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/NestUI.scala
@@ -0,0 +1,69 @@
+/* NEST (New Scala Test)
+ * @author Philipp Haller
+ */
+
+package scala.tools.partest.nest
+
+object NestUI {
+
+ val NONE = 0
+ val SOME = 1
+ val MANY = 2
+
+ private var _outline = ""
+ private var _success = ""
+ private var _failure = ""
+ private var _warning = ""
+ private var _default = ""
+
+ def initialize(number: Int) = number match {
+ case MANY =>
+ _outline = Console.BOLD + Console.BLACK
+ _success = Console.BOLD + Console.GREEN
+ _failure = Console.BOLD + Console.RED
+ _warning = Console.BOLD + Console.YELLOW
+ _default = Console.RESET
+ case SOME =>
+ _outline = Console.BOLD + Console.BLACK
+ _success = Console.RESET
+ _failure = Console.BOLD + Console.BLACK
+ _warning = Console.BOLD + Console.BLACK
+ _default = Console.RESET
+ case _ =>
+ }
+
+ def outline(msg: String) = print(_outline + msg + _default)
+
+ def success(msg: String) = print(_success + msg + _default)
+
+ def failure(msg: String) = print(_failure + msg + _default)
+
+ def warning(msg: String) = print(_warning + msg + _default)
+
+
+ def usage() {
+ println("Usage: NestRunner [<options>] [<testfile> ..] [<resfile>]")
+ println(" --pos next files test a compilation success")
+ println(" --neg next files test a compilation failure")
+ println(" --jvm next files test the JVM backend")
+ println(" --run next files test the interpreter and all backends")
+ println(" --shootout ...")
+ println(" --conservative ...")
+ println(" --verbose display progress information")
+ println(" --version output version information and exit")
+ println
+ println("Send bugs to <scala@listes.epfl.ch>")
+ exit(1)
+ }
+
+
+ var _verbose = false
+
+ def verbose(msg: String) {
+ if (_verbose) {
+ outline("debug: ")
+ println(msg)
+ }
+ }
+
+}
diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala
new file mode 100644
index 0000000000..ba023723f5
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/TestFile.scala
@@ -0,0 +1,77 @@
+/* NEST (New Scala Test)
+ * @author Philipp Haller
+ */
+
+package scala.tools.partest.nest
+
+import java.io.File
+import scala.tools.nsc.Settings
+
+class TestFile(kind: String, val file: File) {
+ val dir = file.getParentFile
+ val dirpath = dir.getAbsolutePath
+
+ val fileBase: String = basename(file.getName)
+
+ val logFile = new File(dir, fileBase + "-" + kind + ".log")
+ val checkFile = {
+ val chkFile = new File(dir, fileBase + ".check")
+ if (chkFile.isFile)
+ chkFile
+ else
+ new File(dir, fileBase + "-" + kind + ".check")
+ }
+
+ // @mutates settings
+ protected def baseSettings(settings: Settings) {
+ settings.classpath.value = dirpath
+ settings.outdir.value = {
+ val outDir = new File(dir, fileBase + "-" + kind + ".obj")
+ if (!outDir.exists) {
+ outDir.mkdir()
+ NestUI.outline(this+" created "+outDir+"\n")
+ } else
+ NestUI.outline(this+" didn't have to create "+outDir+"\n")
+ outDir.toString
+ }
+ }
+
+ def defineSettings(settings: Settings) {
+ baseSettings(settings)
+ }
+
+ private def basename(name: String): String = {
+ val inx = name.lastIndexOf(".")
+ if (inx < 0) name else name.substring(0, inx)
+ }
+
+ override def toString(): String = kind+" "+file
+}
+
+case class PosTestFile(override val file: File) extends TestFile("pos", file)
+
+case class NegTestFile(override val file: File) extends TestFile("neg", file)
+
+case class RunTestFile(override val file: File) extends TestFile("run", file) {
+ override def defineSettings(settings: Settings) {
+ baseSettings(settings)
+ }
+}
+
+case class JvmTestFile(override val file: File) extends TestFile("jvm", file) {
+ import FileManager.{CLASSPATH, EXT_CLASSPATH, PATH_SEP}
+
+ override def defineSettings(settings: Settings) {
+ baseSettings(settings)
+ settings.classpath.value = CLASSPATH+PATH_SEP+EXT_CLASSPATH
+ println("settings.classpath.value="+settings.classpath.value)
+ }
+}
+
+case class ShootoutTestFile(override val file: File) extends TestFile("shootout", file) {
+ override def defineSettings(settings: Settings) {
+ baseSettings(settings)
+ settings.classpath.value = System.getProperty("EXT_CLASSPATH")
+ println("CLASSPATH="+settings.classpath.value)
+ }
+}
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
new file mode 100644
index 0000000000..5999871dd6
--- /dev/null
+++ b/src/partest/scala/tools/partest/nest/Worker.scala
@@ -0,0 +1,169 @@
+/* NEST (New Scala Test)
+ * @author Philipp Haller
+ */
+
+package scala.tools.partest.nest
+
+import java.io.{File, FileInputStream, FileOutputStream, PrintStream}
+import java.net.URL
+
+import scala.tools.nsc.ObjectRunner
+
+import FileManager._
+
+class Worker {
+
+ private def basename(name: String): String = {
+ val inx = name.lastIndexOf(".")
+ if (inx < 0) name else name.substring(0, inx)
+ }
+
+ def execTest(outDir: File, logFile: File) {
+ val cmd =
+ JAVACMD+
+ " -classpath "+outDir+PATH_SEP+CLASSPATH+PATH_SEP+EXT_CLASSPATH+
+ " -Djava.library.path="+logFile.getParentFile.getAbsolutePath+
+ " -Dscalatest.output="+outDir.getAbsolutePath+
+ " -Dscalatest.lib="+LATEST_LIB+
+ " -Djavacmd="+JAVACMD+
+ " scala.tools.nsc.MainGenericRunner"+
+ " Test jvm"
+ NestUI.verbose(cmd)
+ val execution = Runtime.getRuntime.exec(cmd)
+ //TODO: use buffered I/O
+ val in = execution.getInputStream
+ val out = new FileOutputStream(logFile)
+ var c = in.read
+ while (c != -1) {
+ out.write(c)
+ c = in.read
+ }
+ in.close
+ out.close
+ }
+
+ def compareOutput(dir: File, fileBase: String, kind: String, logFile: File): Boolean = {
+ // if check file exists, compare with log file
+ val checkFile = {
+ val chkFile = new File(dir, fileBase + ".check")
+ if (chkFile.isFile)
+ chkFile
+ else
+ new File(dir, fileBase + "-" + kind + ".check")
+ }
+ if (!checkFile.exists || !checkFile.canRead)
+ true
+ else {
+ var success, equalNow = true
+ val bufferSize = 1024
+ val originBuffer, destBuffer = new Array[Byte](bufferSize)
+ val originStream = new FileInputStream(logFile)
+ val destStream = new FileInputStream(checkFile)
+
+ var originSize = originStream.read(originBuffer)
+ while (originSize >= 0) {
+ if (originSize == destStream.read(destBuffer)) {
+ for (idx <- 0 until originSize)
+ equalNow = equalNow && (originBuffer(idx) == destBuffer(idx))
+ if (!equalNow) {
+ success = false
+ NestUI.verbose("Diff1: diffs found")
+ }
+ } else {
+ success = false
+ NestUI.verbose("Diff1: diffs found")
+ }
+ originSize = originStream.read(originBuffer)
+ }
+ if (destStream.read(destBuffer) >= 0)
+ success = false
+ success
+ }
+ }
+
+ def runJvmTests(kind: String, files: List[File]) {
+ val compileMgr = new CompileManager
+ var errors = 0
+ for (file <- files) {
+ var success = true
+ if (!compileMgr.shouldCompile(file, kind)) {
+ NestUI.failure("compilation of "+file+" failed\n")
+ success = false
+ } else {
+ // -------- run test --------
+ val fileBase: String = basename(file.getName)
+ NestUI.verbose(this+" running test "+fileBase)
+ val dir = file.getParentFile
+ val dirpath = dir.getAbsolutePath
+ val outDir = new File(dir, fileBase + "-" + kind + ".obj")
+ val logFile = new File(dir, fileBase + "-" + kind + ".log")
+ //TODO: detect whether we have to use Runtime.exec
+ val useRuntime = true
+
+ if (useRuntime)
+ execTest(outDir, logFile)
+ else {
+ val classpath: List[URL] =
+ outDir.toURL ::
+ List(file.getParentFile.toURL) :::
+ (List.fromString(CLASSPATH, PATH_SEP) map { x =>
+ (new File(x)).toURL }) :::
+ (List.fromString(EXT_CLASSPATH, PATH_SEP) map { x =>
+ (new File(x)).toURL })
+ try {
+ NestUI.verbose("classpath: "+classpath)
+ val out = new FileOutputStream(logFile, true)
+ Console.withOut(new PrintStream(out)) {
+ ObjectRunner.run(classpath, "Test", List("jvm"))
+ }
+ out.flush
+ out.close
+ } catch {
+ case e: Exception =>
+ NestUI.warning(e+" ("+file.getPath+")")
+ }
+ }
+ NestUI.verbose(this+" finished running "+fileBase)
+
+ if (!compareOutput(dir, fileBase, kind, logFile)) {
+ NestUI.failure("output differs from log file\n")
+ success = false
+ }
+ } // successful compile
+ if (!success) {
+ errors += 1
+ NestUI.verbose("incremented errors: "+errors)
+ }
+ } // for each file
+ NestUI.verbose("finished testing "+kind+" with "+errors+" errors")
+ NestUI.verbose("created "+compileMgr.numSeparateCompilers+" separate compilers")
+ }
+
+ def runTests(kind: String, files: List[File]): Unit = kind match {
+ case "pos" =>
+ val compileMgr = new CompileManager
+ var errors = 0
+ for (file <- files) {
+ if (!compileMgr.shouldCompile(file, kind))
+ errors += 1
+ }
+ NestUI.verbose("finished testing "+kind+" with "+errors+" errors")
+ NestUI.verbose("created "+compileMgr.numSeparateCompilers+" separate compilers")
+
+ case "neg" =>
+ val compileMgr = new CompileManager
+ var errors = 0
+ for (file <- files) {
+ if (!compileMgr.shouldFailCompile(file, kind))
+ errors += 1
+ }
+ NestUI.verbose("finished testing "+kind+" with "+errors+" errors")
+ NestUI.verbose("created "+compileMgr.numSeparateCompilers+" separate compilers")
+
+ case "run" =>
+ runJvmTests(kind, files)
+
+ case "jvm" =>
+ runJvmTests(kind, files)
+ }
+}