summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2008-03-11 19:16:15 +0000
committerPhilipp Haller <hallerp@gmail.com>2008-03-11 19:16:15 +0000
commite717d05c2e0d4585283efb79e3b8c562ad74e3f4 (patch)
tree6384788dee0d177954b864ad39185be254f77ea7 /src/partest
parent4b798d9b34187f28bfc41de1deffc87b973ce7c9 (diff)
downloadscala-e717d05c2e0d4585283efb79e3b8c562ad74e3f4.tar.gz
scala-e717d05c2e0d4585283efb79e3b8c562ad74e3f4.tar.bz2
scala-e717d05c2e0d4585283efb79e3b8c562ad74e3f4.zip
Fixed small output issue.
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/nest/ConsoleFileManager.scala2
-rw-r--r--src/partest/scala/tools/partest/nest/Worker.scala57
2 files changed, 52 insertions, 7 deletions
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
index df7e2f78dc..a2fd159d63 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
@@ -140,7 +140,7 @@ else
val srcDir: File = {
val src = new File(TESTROOT, "files")
if (src.isDirectory)
- src
+ src.getCanonicalFile
else {
val path = TESTROOT + File.separator + "files"
NestUI.failure("Source directory \"" + path + "\" not found")
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
index fb02190f42..f7dc932081 100644
--- a/src/partest/scala/tools/partest/nest/Worker.scala
+++ b/src/partest/scala/tools/partest/nest/Worker.scala
@@ -10,7 +10,7 @@ import java.io.{File, FileInputStream, FileOutputStream, PrintStream,
import java.net.URL
-import scala.tools.nsc.ObjectRunner
+import scala.tools.nsc.{ObjectRunner, GenericRunnerCommand}
import scala.actors.Actor
import scala.actors.Actor._
@@ -100,22 +100,65 @@ class Worker(val fileManager: FileManager) extends Actor {
/* Note: not yet used/tested. */
def execTestObjectRunner(file: File, outDir: File, logFile: File) {
+ val consFM = new ConsoleFileManager
+ import consFM.{latestCompFile, latestLibFile, latestActFile,
+ latestPartestFile, latestFjbgFile}
+
val classpath: List[URL] =
outDir.toURL ::
- List(file.getParentFile.toURL) :::
+ //List(file.getParentFile.toURL) :::
+ List(latestCompFile.toURL, latestLibFile.toURL,
+ latestActFile.toURL, latestPartestFile.toURL,
+ latestFjbgFile.toURL) :::
(List.fromString(CLASSPATH, File.pathSeparatorChar) map { x =>
(new File(x)).toURL })
+ NestUI.verbose("ObjectRunner classpath: "+classpath)
+
try {
- NestUI.verbose("classpath: "+classpath)
- val out = new FileOutputStream(logFile, true)
+ // configure input/output files
+ val logOut = new FileOutputStream(logFile)
+ val logWriter = new PrintStream(logOut)
+
+ // grab global lock
+ fileManager.synchronized {
+
+ val oldStdOut = System.out
+ val oldStdErr = System.err
+ System.setOut(logWriter)
+ System.setErr(logWriter)
+
+ /*
+ " -Djava.library.path="+logFile.getParentFile.getAbsolutePath+
+ " -Dscalatest.output="+outDir.getAbsolutePath+
+ " -Dscalatest.lib="+LATEST_LIB+
+ " -Dscalatest.cwd="+outDir.getParent+
+ " -Djavacmd="+JAVACMD+
+ */
+
+ System.setProperty("java.library.path", logFile.getParentFile.getCanonicalFile.getAbsolutePath)
+ System.setProperty("scalatest.output", outDir.getCanonicalFile.getAbsolutePath)
+ System.setProperty("scalatest.lib", LATEST_LIB)
+ System.setProperty("scalatest.cwd", outDir.getParent)
+
+ ObjectRunner.run(classpath, "Test", List("jvm"))
+
+ logWriter.flush()
+ logWriter.close()
+
+ System.setOut(oldStdOut)
+ System.setErr(oldStdErr)
+ }
+
+ /*val out = new FileOutputStream(logFile, true)
Console.withOut(new PrintStream(out)) {
ObjectRunner.run(classpath, "Test", List("jvm"))
}
out.flush
- out.close
+ out.close*/
} catch {
case e: Exception =>
NestUI.verbose(e+" ("+file.getPath+")")
+ e.printStackTrace()
}
}
@@ -132,10 +175,12 @@ class Worker(val fileManager: FileManager) extends Actor {
} else ""
NestUI.verbose("JAVA_OPTS: "+argString)
+ def quote(path: String) = "\""+path+"\""
+
val cmd =
JAVACMD+
" "+argString+
- " -classpath "+outDir+File.pathSeparatorChar+CLASSPATH+
+ " -classpath "+outDir+File.pathSeparator+CLASSPATH+
" -Djava.library.path="+logFile.getParentFile.getAbsolutePath+
" -Dscalatest.output="+outDir.getAbsolutePath+
" -Dscalatest.lib="+LATEST_LIB+