diff options
author | Philipp Haller <hallerp@gmail.com> | 2008-09-04 13:37:58 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2008-09-04 13:37:58 +0000 |
commit | 329de99b63e0c69403c9c6e3084493c58c430a8e (patch) | |
tree | 372c6684d4d365f6e2343e4a34ca0010fd07e144 | |
parent | 8a71b645f23211df28b10791c0822f72c541d9a2 (diff) | |
download | scala-329de99b63e0c69403c9c6e3084493c58c430a8e.tar.gz scala-329de99b63e0c69403c9c6e3084493c58c430a8e.tar.bz2 scala-329de99b63e0c69403c9c6e3084493c58c430a8e.zip |
Enables test dirs for neg tests.
-rw-r--r-- | src/partest/scala/tools/partest/nest/CompileManager.scala | 11 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 21 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala index 44552f89cd..592872fb0c 100644 --- a/src/partest/scala/tools/partest/nest/CompileManager.scala +++ b/src/partest/scala/tools/partest/nest/CompileManager.scala @@ -254,4 +254,15 @@ class CompileManager(val fileManager: FileManager) { withTimeout(files) { !compiler.compile(None, files, kind, log) } + + /* This method returns true iff compilation fails + * _and_ the compiler does _not_ crash or loop. + * + * If the compiler crashes, this method returns false. + */ + def shouldFailCompile(out: File, files: List[File], kind: String, log: File): Boolean = + withTimeout(files) { + !compiler.compile(Some(out), files, kind, log) + } + } diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index fc422ef33a..25c68bfa48 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -365,6 +365,20 @@ class Worker(val fileManager: FileManager) extends Actor { } } + def failCompileFilesIn(dir: File, kind: String, logFile: File, outDir: File) { + val testFiles = dir.listFiles.toList + // 1. compile all '.java' files using javac + val javaFiles = testFiles.filter(_.getName.endsWith(".java")) + if (!javaFiles.isEmpty) + javac(outDir, javaFiles, logFile) + // 2. compile all '.scala' files together + val scalaFiles = testFiles.filter(_.getName.endsWith(".scala")) + if (!scalaFiles.isEmpty && !compileMgr.shouldFailCompile(outDir, scalaFiles, kind, logFile)) { + NestUI.verbose("compilation of "+scalaFiles+" failed\n") + succeeded = false + } + } + def runJvmTest(file: File, kind: String) { runInContext(file, kind, (logFile: File, outDir: File) => { if (file.isDirectory) { @@ -408,9 +422,12 @@ class Worker(val fileManager: FileManager) extends Actor { case "neg" => for (file <- files) { runInContext(file, kind, (logFile: File, outDir: File) => { - if (!compileMgr.shouldFailCompile(List(file), kind, logFile)) { + if (file.isDirectory) { + failCompileFilesIn(file, kind, logFile, outDir) + } else if (!compileMgr.shouldFailCompile(List(file), kind, logFile)) { succeeded = false - } else { // compare log file to check file + } + if (succeeded) { // compare log file to check file val fileBase = basename(file.getName) val dir = file.getParentFile if (!existsCheckFile(dir, fileBase, kind)) { |