From 4e0f38fbb12c8b7faf56bb71846f0b4178ed6470 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sat, 8 May 2021 08:13:47 -0700 Subject: testament :show duration also for failed tests; improve `tshould_not_work`; mitigate #17946 tchannels timeouts (#17947) * refs #17946; refactor testament test summary, show test duration for failures; increase timeout tchannels * revert workarounds from https://github.com/nim-lang/Nim/pull/16698 and add allowPrefixMatch optional param to greedyOrderedSubsetLines * add test * workaround for yet another testament bug --- tests/testament/tshould_not_work.nim | 53 +++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'tests/testament') diff --git a/tests/testament/tshould_not_work.nim b/tests/testament/tshould_not_work.nim index 2777bfe95..e11944e8f 100644 --- a/tests/testament/tshould_not_work.nim +++ b/tests/testament/tshould_not_work.nim @@ -1,39 +1,54 @@ discard """ -cmd: "testament/testament --directory:testament --colors:off --backendLogging:off --nim:$nim category shouldfail" -action: compile -nimout: ''' -FAIL: tests/shouldfail/tccodecheck.nim c + joinable: false +""" + +const expected = """ +FAIL: tests/shouldfail/tccodecheck.nim Failure: reCodegenFailure Expected: baz -FAIL: tests/shouldfail/tcolumn.nim c +FAIL: tests/shouldfail/tcolumn.nim Failure: reLinesDiffer -FAIL: tests/shouldfail/terrormsg.nim c +FAIL: tests/shouldfail/terrormsg.nim Failure: reMsgsDiffer -FAIL: tests/shouldfail/texitcode1.nim c +FAIL: tests/shouldfail/texitcode1.nim Failure: reExitcodesDiffer -FAIL: tests/shouldfail/tfile.nim c +FAIL: tests/shouldfail/tfile.nim Failure: reFilesDiffer -FAIL: tests/shouldfail/tline.nim c +FAIL: tests/shouldfail/tline.nim Failure: reLinesDiffer -FAIL: tests/shouldfail/tmaxcodesize.nim c +FAIL: tests/shouldfail/tmaxcodesize.nim Failure: reCodegenFailure max allowed size: 1 -FAIL: tests/shouldfail/tnimout.nim c +FAIL: tests/shouldfail/tnimout.nim Failure: reMsgsDiffer -FAIL: tests/shouldfail/tnimoutfull.nim c +FAIL: tests/shouldfail/tnimoutfull.nim Failure: reMsgsDiffer -FAIL: tests/shouldfail/toutput.nim c +FAIL: tests/shouldfail/toutput.nim Failure: reOutputsDiffer -FAIL: tests/shouldfail/toutputsub.nim c +FAIL: tests/shouldfail/toutputsub.nim Failure: reOutputsDiffer -FAIL: tests/shouldfail/treject.nim c +FAIL: tests/shouldfail/treject.nim Failure: reFilesDiffer -FAIL: tests/shouldfail/tsortoutput.nim c +FAIL: tests/shouldfail/tsortoutput.nim Failure: reOutputsDiffer -FAIL: tests/shouldfail/ttimeout.nim c +FAIL: tests/shouldfail/ttimeout.nim Failure: reTimeout -FAIL: tests/shouldfail/tvalgrind.nim c +FAIL: tests/shouldfail/tvalgrind.nim Failure: reExitcodesDiffer -''' """ + +import std/[os,strformat,osproc] +import stdtest/testutils + +proc main = + const nim = getCurrentCompilerExe() + # TODO: bin/testament instead? like other tools (eg bin/nim, bin/nimsuggest etc) + let testamentExe = "testament/testament" + let cmd = fmt"{testamentExe} --directory:testament --colors:off --backendLogging:off --nim:{nim} category shouldfail" + let (outp, status) = execCmdEx(cmd) + doAssert status == 1, $status + + let ok = greedyOrderedSubsetLines(expected, outp, allowPrefixMatch = true) + doAssert ok, &"\nexpected:\n{expected}\noutp:\n{outp}" +main() -- cgit 1.4.1-2-gfad0