diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2011-03-01 18:29:40 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2011-03-01 18:29:40 +0000 |
commit | a07df6427f37849f9fc9456acc937082919b23d6 (patch) | |
tree | a2d177e202a23d712cbd2fe71b7ee7887c666908 /src | |
parent | fdaa0a7a0178eab124d65f96e872c07c4400c94a (diff) | |
download | scala-a07df6427f37849f9fc9456acc937082919b23d6.tar.gz scala-a07df6427f37849f9fc9456acc937082919b23d6.tar.bz2 scala-a07df6427f37849f9fc9456acc937082919b23d6.zip |
Long overdue rehaul of presentation compiler te...
Long overdue rehaul of presentation compiler tests. Added support for
options file, and switched simple-tests to use the STARR library on the
test classpath.
Put any options you need passed to the presentation compiler in a file
with the same name as the test, ending in '.opts'. Currently it's used
to set the -bootclasspath for simple-tests. Check the contents of
simple-tests.opts for all the options.
IMPORTANT: when committing a new STARR, you need to check this test.
Most likely, you *will* break it otherwise.
review by extempore
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala index 4345c83014..a00fd44ed3 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala @@ -43,18 +43,46 @@ abstract class InteractiveTest { val settings = new Settings val reporter= new StoreReporter - // need this so that the classpath comes from what partest - // instead of scala.home - settings.usejavacp.value = true - /** The root directory for this test suite, usually the test kind ("test/files/presentation"). */ val outDir = Path(Option(System.getProperty("partest.cwd")).getOrElse(".")) /** The base directory for this test, usually a subdirectory of "test/files/presentation/" */ val baseDir = Option(System.getProperty("partest.testname")).map(outDir / _).getOrElse(Path(".")) -// settings.YpresentationDebug.value = true - lazy val compiler = new Global(settings, reporter) + /** If there's a file ending in .opts, read it and parse it for cmd line arguments. */ + val argsString = { + val optsFile = outDir / "%s.opts".format(System.getProperty("partest.testname")) + val str = try File(optsFile).slurp() catch { + case e: java.io.IOException => "" + } + str.lines.filter(!_.startsWith("#")).mkString(" ") + } + + def prepareSettings() { + // need this so that the classpath comes from what partest + // instead of scala.home + settings.usejavacp.value = !argsString.contains("-bootclasspath") + + // pass any options coming from outside + settings.processArgumentString(argsString) match { + case (false, rest) => + println("error processing arguments (unprocessed: %s)".format(rest)) + case _ => () + } + } + + protected def printClassPath { + println("\toutDir: %s".format(outDir.path)) + println("\tbaseDir: %s".format(baseDir.path)) + println("\targsString: %s".format(argsString)) + println("\tbootClassPath: %s".format(settings.bootclasspath.value)) + println("\tverbose: %b".format(settings.verbose.value)) + } + + lazy val compiler = { + prepareSettings() + new Global(settings, reporter) + } def sources(filename: String*): Seq[SourceFile] = for (f <- filename) yield |