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

Use readOptionFile and don't trim aggressively #91

Merged
merged 1 commit into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/main/scala/scala/tools/partest/nest/Runner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
private def assembleTestCommand(outDir: File, logFile: File): List[String] = {
// check whether there is a ".javaopts" file
val argsFile = testFile changeExtension "javaopts"
val argString = file2String(argsFile)
if (argString != "")
nestUI.verbose("Found javaopts file '%s', using options: '%s'".format(argsFile, argString))
val javaopts = readOptionsFile(argsFile)
if (javaopts.nonEmpty)
nestUI.verbose(s"Found javaopts file '$argsFile', using options: '${javaopts.mkString(",")}'")

val testFullPath = testFile.getAbsolutePath

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

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

// snort or scarf all the contributing flags files
def flagsForCompilation(sources: List[File]): List[String] = {
def argsplitter(s: String) = words(s) filter (_.nonEmpty)
val perTest = argsplitter(flagsFile.fileContents)
val perTest = readOptionsFile(flagsFile)
val perGroup = if (testFile.isDirectory) {
sources flatMap { f => SFile(Path(f) changeExtension "flags").safeSlurp map argsplitter getOrElse Nil }
sources.flatMap(f => readOptionsFile(f changeExtension "flags"))
} else Nil
perTest ++ perGroup
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scala/tools/partest/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ package object partest {
def readOptionsFile(file: File): List[String] = {
file.fileLines match {
case x :: Nil => words(x)
case xs => xs map (_.trim)
case xs => xs
}
}

Expand Down