diff options
author | Paul Phillips <paulp@improving.org> | 2011-03-21 22:25:40 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-03-21 22:25:40 +0000 |
commit | 455ee619fbfde17c8a9208d3e2ebf7d867cbd560 (patch) | |
tree | 686ccedbf5004eeb1507bbedc3b8c0d4b8d273fd /src/partest | |
parent | 7946facede9482d8a363b6474b163c11ab3a662c (diff) | |
download | scala-455ee619fbfde17c8a9208d3e2ebf7d867cbd560.tar.gz scala-455ee619fbfde17c8a9208d3e2ebf7d867cbd560.tar.bz2 scala-455ee619fbfde17c8a9208d3e2ebf7d867cbd560.zip |
[I'm laptop only so there's some chance this wi...
[I'm laptop only so there's some chance this will incur temporary
breakage, but it needs committing.]
Heading off gratuitous complications which haven't yet shipped, I
eliminated the -jar startup option in favor of doing what we already do,
figuring it out. So now all these things work.
scala foo/bar.scala // if file is a script or has one main method
scala foo.Bar // if it has a legal main method scala foo.jar // if it
has a legal MainClass attribute
Also changed "-savecompiled" to "-save" and given scala source called
foo.scala, generate foo.jar rather than foo.scala.jar. Cleaned up a
bunch of related code and further polished the scala startup message.
And unbroke choice settings and improved that error too, which closes
#3849.
While trying to write a test for the choice setting, was reminded that
partest just discards invalid flags files. Made it fail instead, which
closes #3712. Fixed the new failures that revealed. No review.
Diffstat (limited to 'src/partest')
-rw-r--r-- | src/partest/scala/tools/partest/PartestTask.scala | 1 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/CompileManager.scala | 15 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/TestFile.scala | 19 |
3 files changed, 23 insertions, 12 deletions
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala index 551500e626..f1b3ea496d 100644 --- a/src/partest/scala/tools/partest/PartestTask.scala +++ b/src/partest/scala/tools/partest/PartestTask.scala @@ -14,7 +14,6 @@ package partest import scala.actors.Actor._ import scala.util.Properties.setProp import scala.tools.nsc.io.{ Directory, Path => SPath } -import nsc.Settings import nsc.util.ClassPath import util.PathResolver import scala.tools.ant.sabbus.CompilationPathProperty diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala index 42e4d02934..fbf758d5a5 100644 --- a/src/partest/scala/tools/partest/nest/CompileManager.scala +++ b/src/partest/scala/tools/partest/nest/CompileManager.scala @@ -10,10 +10,9 @@ package nest import scala.tools.nsc.{ Global, Settings, CompilerCommand, FatalError, io } import scala.tools.nsc.reporters.{ Reporter, ConsoleReporter } -import scala.tools.nsc.util.ClassPath +import scala.tools.nsc.util.{ ClassPath, FakePos } import scala.tools.util.PathResolver import io.Path - import java.io.{ File, BufferedReader, PrintWriter, FileReader, Writer, FileWriter, StringWriter } import File.pathSeparator @@ -95,7 +94,13 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler { case "presentation" => PresentationTestFile.apply } val test: TestFile = testFileFn(files.head, fileManager) - test.defineSettings(command.settings, out.isEmpty) + if (!test.defineSettings(command.settings, out.isEmpty)) { + testRep.error(FakePos("partest"), test.flags match { + case Some(flags) => "bad flags: " + flags + case _ => "bad settings: " + command.settings + }) + } + val toCompile = files map (_.getPath) try { @@ -106,8 +111,8 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler { testRep.error(null, "fatal error: " + msg) } - testRep.printSummary - testRep.writer.close + testRep.printSummary() + testRep.writer.close() } finally logWriter.close() diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala index 9bfb4a992a..a00b94eba9 100644 --- a/src/partest/scala/tools/partest/nest/TestFile.scala +++ b/src/partest/scala/tools/partest/nest/TestFile.scala @@ -24,13 +24,18 @@ abstract class TestFile(kind: String) { def setOutDirTo = objectDir - def defineSettings(settings: Settings, setOutDir: Boolean) = { + def defineSettings(settings: Settings, setOutDir: Boolean): Boolean = { settings.classpath append dir.path if (setOutDir) settings.outdir.value = setOutDirTo.path - flags foreach (settings processArgumentString _) + // have to catch bad flags somewhere + flags foreach { f => + if (!settings.processArgumentString(f)._1) + return false + } settings.classpath append fileManager.CLASSPATH + true } override def toString(): String = "%s %s".format(kind, file) @@ -49,10 +54,12 @@ case class ScalapTestFile(file: JFile, fileManager: FileManager) extends TestFil override def setOutDirTo = file.parent } case class SpecializedTestFile(file: JFile, fileManager: FileManager) extends TestFile("specialized") { - override def defineSettings(settings: Settings, setOutDir: Boolean) = { - super.defineSettings(settings, setOutDir) - // add the instrumented library version to classpath - settings.classpath.value = ClassPath.join(PathSettings.srcSpecLib.toString, settings.classpath.value) + override def defineSettings(settings: Settings, setOutDir: Boolean): Boolean = { + super.defineSettings(settings, setOutDir) && { + // add the instrumented library version to classpath + settings.classpath prepend PathSettings.srcSpecLib.toString + true + } } } case class PresentationTestFile(file: JFile, fileManager: FileManager) extends TestFile("presentation") |