diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-03-28 00:29:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-28 00:29:06 -0700 |
commit | 6a355a4db05addb01fc02df0243c540f100bf107 (patch) | |
tree | f390e55f921e2d8d215b61c744cf5e5276b875ad /testament/testament.nim | |
parent | b77a420d3eb118cc92443e925f48996fe419f662 (diff) | |
download | Nim-6a355a4db05addb01fc02df0243c540f100bf107.tar.gz |
nim: unbreak CI; testament: add allowedFailure logic for tests that may fail but should still run (#17513)
Diffstat (limited to 'testament/testament.nim')
-rw-r--r-- | testament/testament.nim | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/testament/testament.nim b/testament/testament.nim index 6fc7e32ce..462c0a57c 100644 --- a/testament/testament.nim +++ b/testament/testament.nim @@ -66,7 +66,8 @@ proc isNimRepoTests(): bool = type Category = distinct string TResults = object - total, passed, skipped: int + total, passed, failedButAllowed, skipped: int + ## xxx rename passed to passedOrAllowedFailure data: string TTest = object name: string @@ -212,6 +213,7 @@ proc callCCompiler(cmdTemplate, filename, options: string, proc initResults: TResults = result.total = 0 result.passed = 0 + result.failedButAllowed = 0 result.skipped = 0 result.data = "" @@ -239,16 +241,20 @@ template maybeStyledEcho(args: varargs[untyped]): untyped = proc `$`(x: TResults): string = - result = ("Tests passed: $1 / $3 <br />\n" & - "Tests skipped: $2 / $3 <br />\n") % - [$x.passed, $x.skipped, $x.total] + result = """ +Tests passed or allowed to fail: $2 / $1 <br /> +Tests failed and allowed to fail: $3 / $1 <br /> +Tests skipped: $4 / $1 <br /> +""" % [$x.total, $x.passed, $x.failedButAllowed, $x.skipped] proc addResult(r: var TResults, test: TTest, target: TTarget, - expected, given: string, successOrig: TResultEnum) = + expected, given: string, successOrig: TResultEnum, allowFailure = false) = # test.name is easier to find than test.name.extractFilename # A bit hacky but simple and works with tests/testament/tshould_not_work.nim var name = test.name.replace(DirSep, '/') name.add ' ' & $target + if allowFailure: + name.add " (allowed to fail) " if test.options.len > 0: name.add ' ' & test.options let duration = epochTime() - test.startTime |