testament: make valgrind optional (#21238)

Add a simple switch to enable/disable valgrind support. On by default
This commit is contained in:
Anna 2023-01-11 22:23:43 +05:00 • committed by GitHub
commit e4e947232b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -50,6 +50,7 @@ Options
--colors:on|off Turn messages coloring on|off. --colors:on|off Turn messages coloring 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.
--megatest:on|off Enable or disable megatest. Default is on. --megatest:on|off Enable or disable megatest. Default is on.
--valgrind:on|off Enable or disable valgrind support. Default is on.
--skipFrom:file Read tests to skip from `file` - one test per line, # comments ignored --skipFrom:file Read tests to skip from `file` - one test per line, # comments ignored

View file

@ -29,6 +29,7 @@ var backendLogging = true
var simulate = false var simulate = false
var optVerbose = false var optVerbose = false
var useMegatest = true var useMegatest = true
var valgrindEnabled = true
proc verboseCmd(cmd: string) = proc verboseCmd(cmd: string) =
if optVerbose: if optVerbose:
@ -60,6 +61,7 @@ Options:
--colors:on|off Turn messages coloring on|off. --colors:on|off Turn messages coloring 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.
--megatest:on|off Enable or disable megatest. Default is on. --megatest:on|off Enable or disable megatest. Default is on.
--valgrind:on|off Enable or disable valgrind support. Default is on.
--skipFrom:file Read tests to skip from `file` - one test per line, # comments ignored --skipFrom:file Read tests to skip from `file` - one test per line, # comments ignored
On Azure Pipelines, testament will also publish test results via Azure Pipelines' Test Management API On Azure Pipelines, testament will also publish test results via Azure Pipelines' Test Management API
@ -487,7 +489,7 @@ proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec,
args = @["--unhandled-rejections=strict", exeFile] & args args = @["--unhandled-rejections=strict", exeFile] & args
else: else:
exeCmd = exeFile.dup(normalizeExe) exeCmd = exeFile.dup(normalizeExe)
if expected.useValgrind != disabled: if valgrindEnabled and expected.useValgrind != disabled:
var valgrindOptions = @["--error-exitcode=1"] var valgrindOptions = @["--error-exitcode=1"]
if expected.useValgrind != leaking: if expected.useValgrind != leaking:
valgrindOptions.add "--leak-check=yes" valgrindOptions.add "--leak-check=yes"
@ -664,6 +666,14 @@ proc main() =
useMegatest = false useMegatest = false
else: else:
quit Usage quit Usage
of "valgrind":
case p.val:
of "on":
valgrindEnabled = true
of "off":
valgrindEnabled = false
else:
quit Usage
of "backendlogging": of "backendlogging":
case p.val: case p.val:
of "on": of "on":