summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-09-22 00:45:54 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-09-22 00:45:54 +0200
commite6a5f19ff7ecaf90659070438c131cf316845c64 (patch)
tree15ff44847aa3b673bcb1d32a1f8ebf88bfb55b13
parent3cdbcf0c8610c564ea50ed6cf9e82d35c5750ce9 (diff)
downloadscala-e6a5f19ff7ecaf90659070438c131cf316845c64.tar.gz
scala-e6a5f19ff7ecaf90659070438c131cf316845c64.tar.bz2
scala-e6a5f19ff7ecaf90659070438c131cf316845c64.zip
partest now always produces log files with LFs
-rw-r--r--src/partest/scala/tools/partest/nest/DirectRunner.scala2
-rw-r--r--src/partest/scala/tools/partest/nest/RunnerManager.scala25
2 files changed, 23 insertions, 4 deletions
diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala
index a07705322d..a890a57f14 100644
--- a/src/partest/scala/tools/partest/nest/DirectRunner.scala
+++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala
@@ -37,6 +37,8 @@ trait DirectRunner {
})
}
def runTestsForFiles(_kindFiles: List[File], kind: String): immutable.Map[String, TestState] = {
+ System.setProperty("line.separator", "\n")
+
// @partest maintainer: we cannot create a fresh file manager here
// since the FM must respect --buildpath and --classpath from the command line
// for example, see how it's done in ReflectiveRunner
diff --git a/src/partest/scala/tools/partest/nest/RunnerManager.scala b/src/partest/scala/tools/partest/nest/RunnerManager.scala
index 4961424e1b..7a42853749 100644
--- a/src/partest/scala/tools/partest/nest/RunnerManager.scala
+++ b/src/partest/scala/tools/partest/nest/RunnerManager.scala
@@ -138,12 +138,29 @@ class RunnerManager(kind: String, val fileManager: FileManager, params: TestRunP
catch exHandler(output, "javac command failed:\n" + args.map(" " + _ + "\n").mkString + "\n", CompilerCrashed)
}
- /** Runs command redirecting standard out and
- * error out to output file.
+ /** Runs command redirecting standard out and error out to output file.
+ * Overloaded to accept a sequence of arguments.
*/
private def runCommand(args: Seq[String], outFile: File): Boolean = {
NestUI.verbose("running command:\n"+args.map(" " + _ + "\n").mkString)
- (Process(args) #> outFile !) == 0
+ runCommandImpl(Process(args), outFile)
+ }
+
+ /** Runs command redirecting standard out and error out to output file.
+ * Overloaded to accept a single string = concatenated command + arguments.
+ */
+ private def runCommand(command: String, outFile: File): Boolean = {
+ NestUI.verbose("running command:"+command)
+ runCommandImpl(Process(command), outFile)
+ }
+
+ private def runCommandImpl(process: => ProcessBuilder, outFile: File): Boolean = {
+ val exitCode = (process #> outFile !)
+ // normalize line endings
+ // System.getProperty("line.separator") should be "\n" here
+ // so reading a file and writing it back should convert all CRLFs to LFs
+ SFile(outFile).printlnAll(SFile(outFile).lines.toList: _*)
+ exitCode == 0
}
@inline private def isJava(f: File) = SFile(f) hasExtension "java"
@@ -767,7 +784,7 @@ class RunnerManager(kind: String, val fileManager: FileManager, params: TestRunP
}
else file.getAbsolutePath
- val ok = ((cmdString+argString) #> logFile !) == 0
+ val ok = runCommand(cmdString+argString, logFile)
( ok && diffCheck(file, compareOutput(file.getParentFile, logFile)) )
}
catch { case e: Exception => NestUI.verbose("caught "+e) ; false }