diff options
author | Paul Phillips <paulp@improving.org> | 2010-10-30 20:27:34 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-10-30 20:27:34 +0000 |
commit | b4d47496cb87ec2dd0c47c7d4b7a38cb9842d900 (patch) | |
tree | f72302ce30b4805a73b3f0150238c6fce4a64273 /src | |
parent | adbad7ba56a089a4365624a98d872cb040b55c37 (diff) | |
download | scala-b4d47496cb87ec2dd0c47c7d4b7a38cb9842d900.tar.gz scala-b4d47496cb87ec2dd0c47c7d4b7a38cb9842d900.tar.bz2 scala-b4d47496cb87ec2dd0c47c7d4b7a38cb9842d900.zip |
Ported --update-check from partest-alternative ...
Ported --update-check from partest-alternative to partest actual. Once
again all can daily demonstrate their amazing resolve by not mass
updating checkfiles by the hundreds with whatever the current output
happens to be. No review.
Diffstat (limited to 'src')
4 files changed, 16 insertions, 6 deletions
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index fe77621eee..eb7d9b9e2b 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -56,7 +56,7 @@ class ConsoleRunner extends DirectRunner { private val unaryArgs = List( "--pack", "--all", "--verbose", "--show-diff", "--show-log", - "--failed", "--version", "--ansi", "--debug" + "--failed", "--update-check", "--version", "--ansi", "--debug" ) ::: testSetArgs private val binaryArgs = List( @@ -86,10 +86,11 @@ class ConsoleRunner extends DirectRunner { def argNarrowsTests(x: String) = denotesTestSet(x) || denotesTestFile(x) || denotesTestDir(x) - NestUI._verbose = parsed isSet "--verbose" - fileManager.showDiff = parsed isSet "--show-diff" - fileManager.showLog = parsed isSet "--show-log" - fileManager.failed = parsed isSet "--failed" + NestUI._verbose = parsed isSet "--verbose" + fileManager.showDiff = parsed isSet "--show-diff" + fileManager.updateCheck = parsed isSet "--update-check" + fileManager.showLog = parsed isSet "--show-log" + fileManager.failed = parsed isSet "--failed" if (parsed isSet "--ansi") NestUI initialize NestUI.MANY if (parsed isSet "--timeout") fileManager.timeout = parsed("--timeout") diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index bdbb34b3c4..35f4494f65 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -43,6 +43,7 @@ trait FileManager { var LATEST_LIB: String var showDiff = false + var updateCheck = false var showLog = false var failed = false diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala index efff4e8375..4a632a98d5 100644 --- a/src/partest/scala/tools/partest/nest/NestUI.scala +++ b/src/partest/scala/tools/partest/nest/NestUI.scala @@ -87,6 +87,7 @@ object NestUI { println(" --show-log show log") println(" --show-diff show diff between log and check file") println(" --failed run only those tests that failed during the last run") + println(" --update-check instead of failing tests with output change, update checkfile. (Use with care!)") println(" --verbose show progress information") println(" --buildpath set (relative) path to build jars") println(" ex.: --buildpath build/pack") diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 2a8bf18c7a..0c12f7cad8 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -349,7 +349,14 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor def compareOutput(dir: File, fileBase: String, kind: String, logFile: File): String = // if check file exists, compare with log file getCheckFile(dir, fileBase, kind) match { - case Some(f) => fileManager.compareFiles(logFile, f.jfile) + case Some(f) => + val diff = fileManager.compareFiles(logFile, f.jfile) + if (diff != "" && fileManager.updateCheck) { + NestUI.verbose("output differs from log file: updating checkfile\n") + f.toFile writeAll file2String(logFile) + "" + } + else diff case _ => file2String(logFile) } |