Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit 038308e

Browse files
authored
Merge pull request #91 from som-snytt/issue/79-flags
Use readOptionFile and don't trim aggressively
2 parents 113cfd8 + f66558b commit 038308e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/scala/scala/tools/partest/nest/Runner.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
152152
private def assembleTestCommand(outDir: File, logFile: File): List[String] = {
153153
// check whether there is a ".javaopts" file
154154
val argsFile = testFile changeExtension "javaopts"
155-
val argString = file2String(argsFile)
156-
if (argString != "")
157-
nestUI.verbose("Found javaopts file '%s', using options: '%s'".format(argsFile, argString))
155+
val javaopts = readOptionsFile(argsFile)
156+
if (javaopts.nonEmpty)
157+
nestUI.verbose(s"Found javaopts file '$argsFile', using options: '${javaopts.mkString(",")}'")
158158

159159
val testFullPath = testFile.getAbsolutePath
160160

@@ -186,7 +186,7 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
186186
val classpath = joinPaths(extraClasspath ++ testClassPath)
187187

188188
javaCmdPath +: (
189-
(suiteRunner.javaOpts.split(' ') ++ extraJavaOptions ++ argString.split(' ')).map(_.trim).filter(_ != "").toList ++ Seq(
189+
(suiteRunner.javaOpts.split(' ') ++ extraJavaOptions ++ javaopts).filter(_ != "").toList ++ Seq(
190190
"-classpath",
191191
join(outDir.toString, classpath)
192192
) ++ propertyOptions ++ Seq(
@@ -445,10 +445,9 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
445445

446446
// snort or scarf all the contributing flags files
447447
def flagsForCompilation(sources: List[File]): List[String] = {
448-
def argsplitter(s: String) = words(s) filter (_.nonEmpty)
449-
val perTest = argsplitter(flagsFile.fileContents)
448+
val perTest = readOptionsFile(flagsFile)
450449
val perGroup = if (testFile.isDirectory) {
451-
sources flatMap { f => SFile(Path(f) changeExtension "flags").safeSlurp map argsplitter getOrElse Nil }
450+
sources.flatMap(f => readOptionsFile(f changeExtension "flags"))
452451
} else Nil
453452
perTest ++ perGroup
454453
}

src/main/scala/scala/tools/partest/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ package object partest {
146146
def readOptionsFile(file: File): List[String] = {
147147
file.fileLines match {
148148
case x :: Nil => words(x)
149-
case xs => xs map (_.trim)
149+
case xs => xs
150150
}
151151
}
152152

0 commit comments

Comments
 (0)