summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2008-07-29 15:17:41 +0000
committerIulian Dragos <jaguarul@gmail.com>2008-07-29 15:17:41 +0000
commitf4efeb88f2b61f1ad6751988d09d288e77e33c17 (patch)
tree1cccce207f0b9d5a6a1c360663de331f488945d8
parent9638b5c79adb9aed20a84eab9a21730e9f697281 (diff)
downloadscala-f4efeb88f2b61f1ad6751988d09d288e77e33c17.tar.gz
scala-f4efeb88f2b61f1ad6751988d09d288e77e33c17.tar.bz2
scala-f4efeb88f2b61f1ad6751988d09d288e77e33c17.zip
Fixed partest to accept additional flags on a p...
Fixed partest to accept additional flags on a per test basis.
-rw-r--r--src/compiler/scala/tools/ant/Scalac.scala14
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala17
-rw-r--r--src/partest/scala/tools/partest/nest/TestFile.scala11
3 files changed, 28 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala
index 4965071581..ec159abaa2 100644
--- a/src/compiler/scala/tools/ant/Scalac.scala
+++ b/src/compiler/scala/tools/ant/Scalac.scala
@@ -545,19 +545,7 @@ class Scalac extends MatchingTask {
if (!assemrefs.isEmpty) settings.assemrefs.value = assemrefs.get
log("Scalac params = '" + addParams + "'", Project.MSG_DEBUG)
- var args =
- if (addParams.trim() == "") Nil
- else List.fromArray(addParams.trim().split(" ")).map(_.trim())
- while (!args.isEmpty) {
- val argsBuf = args
- if (args.head startsWith "-") {
- for (setting <- settings.allSettings)
- args = setting.tryToSet(args);
- }
- else error("Parameter '" + args.head + "' does not start with '-'.")
- if (argsBuf eq args)
- error("Parameter '" + args.head + "' is not recognised by Scalac.")
- }
+ settings.parseParams(addParams, error)
(settings, sourceFiles)
}
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index 5b42d47c69..ab87b1228d 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -191,6 +191,23 @@ class Settings(error: String => Unit) {
ok
}
+ /** Try to add additional command line parameters. */
+ def parseParams(line: String, error: String => Nothing) {
+ var args =
+ if (line.trim() == "") Nil
+ else List.fromArray(line.trim().split(" ")).map(_.trim())
+ while (!args.isEmpty) {
+ val argsBuf = args
+ if (args.head startsWith "-") {
+ for (setting <- allSettings)
+ args = setting.tryToSet(args);
+ }
+ else error("Parameter '" + args.head + "' does not start with '-'.")
+ if (argsBuf eq args)
+ error("Parameter '" + args.head + "' is not recognised by Scalac.")
+ }
+ }
+
/** A base class for settings of all types.
* Subclasses each define a `value' field of the appropriate type.
*/
diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala
index d569ba6b4e..10b12aae29 100644
--- a/src/partest/scala/tools/partest/nest/TestFile.scala
+++ b/src/partest/scala/tools/partest/nest/TestFile.scala
@@ -7,7 +7,7 @@
package scala.tools.partest.nest
-import java.io.File
+import java.io.{File, BufferedReader, FileReader}
import scala.tools.nsc.Settings
class TestFile(kind: String, val file: File, val fileManager: FileManager) {
@@ -24,6 +24,15 @@ class TestFile(kind: String, val file: File, val fileManager: FileManager) {
outDir.mkdir()
outDir.toString
}
+
+ // add additional flags found in 'testname.flags'
+ val flagsFile = new File(dir, fileBase + ".flags")
+ if (flagsFile.exists) {
+ val reader = new BufferedReader(new java.io.FileReader(flagsFile))
+ val flags = reader.readLine
+ if (flags ne null)
+ settings.parseParams(flags, error)
+ }
}
def defineSettings(settings: Settings) {