mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
allow to disable backend logging
This commit is contained in:
@@ -15,6 +15,7 @@ import
|
||||
algorithm, compiler/nodejs, times, sets, md5
|
||||
|
||||
var useColors = true
|
||||
var backendLogging = true
|
||||
|
||||
const
|
||||
resultsFile = "testresults.html"
|
||||
@@ -35,7 +36,8 @@ Options:
|
||||
--targets:"c c++ js objc" run tests for specified targets (default: all)
|
||||
--nim:path use a particular nim executable (default: compiler/nim)
|
||||
--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.
|
||||
""" % resultsFile
|
||||
|
||||
type
|
||||
@@ -219,13 +221,14 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
|
||||
let name = test.name.extractFilename & " " & $target & test.options
|
||||
let duration = epochTime() - test.startTime
|
||||
let durationStr = duration.formatFloat(ffDecimal, precision = 8).align(11)
|
||||
backend.writeTestResult(name = name,
|
||||
category = test.cat.string,
|
||||
target = $target,
|
||||
action = $test.spec.action,
|
||||
result = $success,
|
||||
expected = expected,
|
||||
given = given)
|
||||
if backendLogging:
|
||||
backend.writeTestResult(name = name,
|
||||
category = test.cat.string,
|
||||
target = $target,
|
||||
action = $test.spec.action,
|
||||
result = $success,
|
||||
expected = expected,
|
||||
given = given)
|
||||
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
|
||||
if success == reSuccess:
|
||||
maybeStyledEcho fgGreen, "PASS: ", fgCyan, alignLeft(name, 60), fgBlue, " (", durationStr, " secs)"
|
||||
@@ -531,6 +534,14 @@ proc main() =
|
||||
useColors = false
|
||||
else:
|
||||
quit Usage
|
||||
of "backendlogging":
|
||||
case p.val.string:
|
||||
of "on":
|
||||
backendLogging = true
|
||||
of "off":
|
||||
backendLogging = false
|
||||
else:
|
||||
quit Usage
|
||||
else:
|
||||
quit Usage
|
||||
p.next()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "testament/tester --directory:testament --colors:off --nim:../compiler/nim category shouldfail"
|
||||
cmd: "testament/tester --directory:testament --colors:off --backendLogging:off --nim:../compiler/nim category shouldfail"
|
||||
action: compile
|
||||
nimout: '''
|
||||
FAIL: tccodecheck.nim C
|
||||
|
||||
Reference in New Issue
Block a user