diff options
author | Paul Phillips <paulp@improving.org> | 2011-06-10 17:32:05 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-06-10 17:32:05 +0000 |
commit | 4e85b6fb33baad9910b3d776867dc16c2816acdf (patch) | |
tree | e92d9829e239cb1744f688a7831d3f83c291fc8b | |
parent | 07fab88cee34e5f59cf88f0dc8e61f2b8817eb24 (diff) | |
download | scala-4e85b6fb33baad9910b3d776867dc16c2816acdf.tar.gz scala-4e85b6fb33baad9910b3d776867dc16c2816acdf.tar.bz2 scala-4e85b6fb33baad9910b3d776867dc16c2816acdf.zip |
Tweaks repl tests to enforce -Yrepl-sync and ot...
Tweaks repl tests to enforce -Yrepl-sync and other setup on all clients.
Also includes some more why-do-tests-hang bosons for the particle
accelerator in case that doesn't wrap it up. I think it will though,
because now constrained-types is the only one which failed and it's also
the only one which overrides Settings. No review.
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/IMain.scala | 4 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/ReplTest.scala | 18 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/DirectRunner.scala | 2 | ||||
-rw-r--r-- | test/files/run/constrained-types.scala | 5 | ||||
-rwxr-xr-x | test/partest | 14 |
5 files changed, 31 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index 5c8679a93c..11ab21e952 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -129,8 +129,10 @@ class IMain(val settings: Settings, protected val out: JPrintWriter) extends Imp } } def initializeSynchronous(): Unit = { - if (!isInitializeComplete) + if (!isInitializeComplete) { _initialize() + assert(global != null, global) + } } def isInitializeComplete = _initializeComplete diff --git a/src/partest/scala/tools/partest/ReplTest.scala b/src/partest/scala/tools/partest/ReplTest.scala index 5822328e68..02ab154d4b 100644 --- a/src/partest/scala/tools/partest/ReplTest.scala +++ b/src/partest/scala/tools/partest/ReplTest.scala @@ -14,12 +14,22 @@ import java.lang.reflect.{ Method => JMethod, Field => JField } */ abstract class ReplTest extends App { def code: String - // override to add additional settings + // override to add additional settings with strings def extraSettings: String = "" - def settings: Settings = { + // override to transform Settings object immediately before the finish + def transformSettings(s: Settings): Settings = s + + // final because we need to enforce the existence of a couple settings. + final def settings: Settings = { val s = new Settings - s processArgumentString (extraSettings + " -Yrepl-sync -Xnojline") - s + s.Yreplsync.value = true + s.Xnojline.value = true + val settingString = sys.props("scala.partest.debug.repl-args") match { + case null => extraSettings + case s => extraSettings + " " + s + } + s processArgumentString settingString + transformSettings(s) } def eval() = ILoop.runForTranscript(code, settings).lines drop 1 def show() = eval() foreach println diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala index d4b1c8dcb1..7257f02c0b 100644 --- a/src/partest/scala/tools/partest/nest/DirectRunner.scala +++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala @@ -60,7 +60,7 @@ trait DirectRunner { val scalaCheckParentClassLoader = ScalaClassLoader.fromURLs( List(scalacheckURL, latestCompFile.toURI.toURL, latestLibFile.toURI.toURL, latestPartestFile.toURI.toURL) ) - Output.init + Output.init() val workers = kindFiles.grouped(groupSize).toList map { toTest => val worker = new Worker(fileManager, TestRunParams(scalaCheckParentClassLoader)) diff --git a/test/files/run/constrained-types.scala b/test/files/run/constrained-types.scala index 5f7eb7adde..91bd856d00 100644 --- a/test/files/run/constrained-types.scala +++ b/test/files/run/constrained-types.scala @@ -79,15 +79,12 @@ val x : Int @Where(self > 0 && self < 100) = 3 """ - override def settings: Settings = { - val s = new Settings - + override def transformSettings(s: Settings): Settings = { s.Xexperimental.value = true s.selfInAnnots.value = true s.deprecation.value = true // when running that compiler, give it a scala-library to the classpath s.classpath.value = sys.props("java.class.path") - s } } diff --git a/test/partest b/test/partest index 44f7130968..ebf6891fdc 100755 --- a/test/partest +++ b/test/partest @@ -74,7 +74,9 @@ if $cygwin; then EXT_CLASSPATH=`cygpath --path --$format "$EXT_CLASSPATH"` fi -[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx1024M -Xms16M" +# last arg wins, so if JAVA_OPTS already contains -Xmx or -Xms the +# supplied argument will be used. +JAVA_OPTS="-Xmx1024M -Xms64M $JAVA_OPTS" [ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation" partestDebugStr="" @@ -82,4 +84,12 @@ if [ ! -z "${PARTEST_DEBUG}" ] ; then partestDebugStr="-Dpartest.debug=${PARTEST_DEBUG}" fi -${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" ${partestDebugStr} -Dscala.home="${SCALA_HOME}" -Dpartest.javacmd="${JAVACMD}" -Dpartest.java_opts="${JAVA_OPTS}" -Dpartest.scalac_opts="${SCALAC_OPTS}" -Dpartest.javac_cmd="${JAVA_HOME}/bin/javac" scala.tools.partest.nest.NestRunner "$@" +${JAVACMD:=java} \ + $JAVA_OPTS -cp "$EXT_CLASSPATH" \ + ${partestDebugStr} \ + -Dscala.home="${SCALA_HOME}" \ + -Dpartest.javacmd="${JAVACMD}" \ + -Dpartest.java_opts="${JAVA_OPTS}" \ + -Dpartest.scalac_opts="${SCALAC_OPTS}" \ + -Dpartest.javac_cmd="${JAVA_HOME}/bin/javac" \ + scala.tools.partest.nest.NestRunner "$@" |