summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2008-09-18 09:01:38 +0000
committerPhilipp Haller <hallerp@gmail.com>2008-09-18 09:01:38 +0000
commitc8b96646e564d36999bda16b79f72a027332224c (patch)
tree602c83160b2764ccda27dabbad4f72029d02f258
parente4d18ccfbb3ad49eb1408eec773f72527bce4b11 (diff)
downloadscala-c8b96646e564d36999bda16b79f72a027332224c.tar.gz
scala-c8b96646e564d36999bda16b79f72a027332224c.tar.bz2
scala-c8b96646e564d36999bda16b79f72a027332224c.zip
Boot class path and ext dirs are now set proper...
Boot class path and ext dirs are now set properly when creating compilers to be tested. partest runner script now reads PARTEST_DEBUG env. var (setting it to true enables debug output).
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala14
-rw-r--r--src/partest/scala/tools/partest/nest/CompileManager.scala11
-rw-r--r--src/partest/scala/tools/partest/nest/ReflectiveRunner.scala11
-rwxr-xr-xtest/partest2
4 files changed, 28 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index cb82056560..24be800f2f 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -15,33 +15,33 @@ class Settings(error: String => Unit) {
private var allsettings: List[Setting] = List()
- private def getProperty(name: String): String =
+ protected def getProperty(name: String): String =
if (System.getProperty(name) != "")
System.getProperty(name)
else null
- private val classpathDefault =
+ protected val classpathDefault =
if (System.getProperty("env.classpath") ne null)
alternatePath(
getProperty("env.classpath"),
".")
else getProperty("java.class.path")
- private val bootclasspathDefault =
+ protected val bootclasspathDefault =
alternatePath(
concatPath(
getProperty("sun.boot.class.path"),
guessedScalaBootClassPath),
"")
- private val extdirsDefault =
+ protected val extdirsDefault =
alternatePath(
concatPath(
getProperty("java.ext.dirs"),
guessedScalaExtDirs),
"")
- private val pluginsDirDefault =
+ protected val pluginsDirDefault =
if (Properties.scalaHome == null)
""
else
@@ -51,10 +51,10 @@ class Settings(error: String => Unit) {
"scala-devel"),
"plugins").getAbsolutePath
- private def alternatePath(p1: String, p2: => String) =
+ protected def alternatePath(p1: String, p2: => String) =
if (p1 ne null) p1 else p2
- private def concatPath(p1: String, p2: String) =
+ protected def concatPath(p1: String, p2: String) =
if ((p1 ne null) && (p2 ne null)) p1 + File.pathSeparator + p2
else if (p1 ne null) p1
else p2
diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala
index 29981bcac4..87c3a7db85 100644
--- a/src/partest/scala/tools/partest/nest/CompileManager.scala
+++ b/src/partest/scala/tools/partest/nest/CompileManager.scala
@@ -23,12 +23,19 @@ abstract class SimpleCompiler {
def compile(out: Option[File], files: List[File], kind: String, log: File): Boolean
}
+class TestSettings extends {
+ override val bootclasspathDefault =
+ System.getProperty("sun.boot.class.path", "")
+ override val extdirsDefault =
+ System.getProperty("java.ext.dirs", "")
+} with Settings(x => ())
+
class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
def newGlobal(settings: Settings, reporter: Reporter): Global =
new Global(settings, reporter)
def newGlobal(settings: Settings, logWriter: FileWriter): Global = {
- val rep = new ExtConsoleReporter(new Settings(x => ()),
+ val rep = new ExtConsoleReporter(new TestSettings,
Console.in,
new PrintWriter(logWriter))
rep.shortname = true
@@ -36,7 +43,7 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
}
def newSettings = {
- val settings = new Settings(x => ())
+ val settings = new TestSettings
settings.deprecation.value = true
settings.nowarnings.value = false
settings.encoding.value = "iso-8859-1"
diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
index 7aec84a30e..e99019822c 100644
--- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
@@ -52,6 +52,17 @@ class ReflectiveRunner extends RunnerUtils {
}
try {
+ val newClasspath = sepUrls.mkString(java.io.File.pathSeparator)
+ System.setProperty("java.class.path", newClasspath)
+ System.setProperty("env.classpath", newClasspath)
+ System.setProperty("scala.home", "")
+ if (fileManager.debug) {
+ println("java.class.path: "+System.getProperty("java.class.path"))
+ println("env.classpath: "+System.getProperty("env.classpath"))
+ println("sun.boot.class.path: "+System.getProperty("sun.boot.class.path"))
+ println("java.ext.dirs: "+System.getProperty("java.ext.dirs"))
+ }
+
val sepRunnerClass =
sepLoader.loadClass("scala.tools.partest.nest.ConsoleRunner")
diff --git a/test/partest b/test/partest
index 9c6e13db35..88729ac8c6 100755
--- a/test/partest
+++ b/test/partest
@@ -74,4 +74,4 @@ fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms16M"
[ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation"
-${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" -Dscala.home="${SCALA_HOME}" -Dscalatest.javacmd="${JAVACMD}" -Dscalatest.java_opts="${JAVA_OPTS}" -Dscalatest.scalac_opts="${SCALAC_OPTS}" scala.tools.partest.nest.NestRunner "$@"
+${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" -Dpartest.debug="${PARTEST_DEBUG}" -Dscala.home="${SCALA_HOME}" -Dscalatest.javacmd="${JAVACMD}" -Dscalatest.java_opts="${JAVA_OPTS}" -Dscalatest.scalac_opts="${SCALAC_OPTS}" scala.tools.partest.nest.NestRunner "$@"