summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorSergey Avseyev <sergey.avseyev@gmail.com>2015-05-25 21:16:35 +0300
committerSergey Avseyev <sergey.avseyev@gmail.com>2015-05-25 22:37:30 +0300
commit411e602d134aba05a8d876da41e8abe1b04c374c (patch)
tree2036ba5635bd51e9951195092083c8852f12dd46 /koch.nim
parent71561bef5846fbbfea1f77ecba1f9d6d7426ca43 (diff)
downloadNim-411e602d134aba05a8d876da41e8abe1b04c374c.tar.gz
Introduce pedantic mode for tester
Motivation
----------
External tools need to know whether or not any test in suite failed. For
example buildbot, or packaging tool would like to stop the execution and
mark it as failed if some tests does not pass.

Modification
------------
Add `--pedantic` switch to tester program which will force it to quit
with non-zero exit code if at least one failure detected. Also update
`tests()` proc in koch to inspect result from tester and propagate it to
user.

Result
------
Nothing has changed in default behaviour. But following invocations will
exit with non-zero code if there failed tests:

    ./koch tests --pedantic all
    ./tests/testament/tester --pedantic all
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/koch.nim b/koch.nim
index 55019b544..a951b422f 100644
--- a/koch.nim
+++ b/koch.nim
@@ -333,8 +333,10 @@ proc tests(args: string) =
   # taint mode test :-)
   exec "nim cc --taintMode:on tests/testament/tester"
   let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe)
-  exec tester & " " & (args|"all")
+  let success = tryExec tester & " " & (args|"all")
   exec tester & " html"
+  if not success:
+    quit("tests failed", QuitFailure)
 
 proc temp(args: string) =
   var output = "compiler" / "nim".exe