koch and testament improvement; make testing command easier to get right

This commit is contained in:
Andreas Rumpf 2019-02-08 20:01:20 +01:00
commit 04cdf99448
3 changed files with 6 additions and 7 deletions

View file

@ -412,13 +412,8 @@ template `|`(a, b): string = (if a.len > 0: a else: b)
proc tests(args: string) = proc tests(args: string) =
nimexec "cc --opt:speed testament/tester" nimexec "cc --opt:speed testament/tester"
# Since tests take a long time (on my machine), and we want to defy Murhpys
# law - lets make sure the compiler really is freshly compiled!
nimexec "c --lib:lib -d:release --opt:speed compiler/nim.nim"
let tester = quoteShell(getCurrentDir() / "testament/tester".exe) let tester = quoteShell(getCurrentDir() / "testament/tester".exe)
let success = tryExec tester & " " & (args|"all") let success = tryExec tester & " " & (args|"all")
if not existsEnv("TRAVIS") and not existsEnv("APPVEYOR"):
exec tester & " html"
if not success: if not success:
quit("tests failed", QuitFailure) quit("tests failed", QuitFailure)

View file

@ -9,7 +9,7 @@
import parseutils, strutils, os, osproc, streams, parsecfg import parseutils, strutils, os, osproc, streams, parsecfg
var compilerPrefix* = "nim" var compilerPrefix* = findExe("nim")
let isTravis* = existsEnv("TRAVIS") let isTravis* = existsEnv("TRAVIS")
let isAppVeyor* = existsEnv("APPVEYOR") let isAppVeyor* = existsEnv("APPVEYOR")

View file

@ -42,7 +42,7 @@ Options:
--simulate see what tests would be run but don't run them (for debugging) --simulate see what tests would be run but don't run them (for debugging)
--failing only show failing/ignored tests --failing only show failing/ignored tests
--targets:"c c++ js objc" run tests for specified targets (default: all) --targets:"c c++ js objc" run tests for specified targets (default: all)
--nim:path use a particular nim executable (default: compiler/nim) --nim:path use a particular nim executable (default: $$PATH/nim)
--directory:dir Change to directory dir before reading the tests or doing anything else. --directory:dir Change to directory dir before reading the tests or doing anything else.
--colors:on|off Turn messagescoloring on|off. --colors:on|off Turn messagescoloring on|off.
--backendLogging:on|off Disable or enable backend logging. By default turned on. --backendLogging:on|off Disable or enable backend logging. By default turned on.
@ -537,6 +537,7 @@ proc main() =
var optPrintResults = false var optPrintResults = false
var optFailing = false var optFailing = false
var targetsStr = "" var targetsStr = ""
var isMainProcess = true
var p = initOptParser() var p = initOptParser()
p.next() p.next()
@ -620,6 +621,7 @@ proc main() =
# 'pcat' is used for running a category in parallel. Currently the only # 'pcat' is used for running a category in parallel. Currently the only
# difference is that we don't want to run joinable tests here as they # difference is that we don't want to run joinable tests here as they
# are covered by the 'megatest' category. # are covered by the 'megatest' category.
isMainProcess = false
var cat = Category(p.key) var cat = Category(p.key)
p.next p.next
processCategory(r, cat, p.cmdLineRest.string, testsDir, runJoinableTests = false) processCategory(r, cat, p.cmdLineRest.string, testsDir, runJoinableTests = false)
@ -644,6 +646,8 @@ proc main() =
echo "FAILURE! total: ", r.total, " passed: ", r.passed, " skipped: ", echo "FAILURE! total: ", r.total, " passed: ", r.passed, " skipped: ",
r.skipped, " failed: ", failed r.skipped, " failed: ", failed
quit(QuitFailure) quit(QuitFailure)
if isMainProcess:
echo "Used ", compilerPrefix, " to run the tests. Use --nim to override."
if paramCount() == 0: if paramCount() == 0:
quit Usage quit Usage