Closed xnox closed 1 year ago
With this format, you don't need the "function"/"feature" test banners
Yeah, I'm undecided about how the banners should be done.
From testing point of view, current NIH style tests are straight forward - say what you want to test, do silently or die loud.
TAP feels backwards: do everything, say if did or died, announce what it tried to do.
But indeed function/feature test banners are redundant. Especially when there is no test associated with it.
Also this implementation is very rough, and shredded ARM toolchain into generating hundred thousands of conditional branches out of range assembler errors. But not on Intel / PowerPC. I must be writing really bad code.
The other problem is that libnih tests aren't intended to be "crash safe", a crash is just a way of failing.
So to be truly TAP-safe you'd have to run each test in a child process and check exit statuses
Otherwise you'll randomly miss out tests if one crashes
On Thursday, November 7, 2013, xnox wrote:
Yeah, I'm undecided about how the banners should be done.
From testing point of view, current NIH style tests are straight forward - say what you want to test, do silently or die loud.
TAP feels backwards: do everything, say if did or died, announce what it tried to do.
But indeed function/feature test banners are redundant. Especially when there is no test associated with it.
Also this implementation is very rough, and shredded ARM toolchain into generating hundred thousands of conditional branches out of range assembler errors. But not on Intel / PowerPC. I must be writing really bad code.
— Reply to this email directly or view it on GitHubhttps://github.com/keybuk/libnih/pull/8#issuecomment-28019488 .
Have you ever, ever felt like this? Had strange things happen? Are you going round the twist?
At the moment the api is fully compatible with existing one, but to introduce skip (e.g. TEST_SKIP_UNLESS) and expect failure (e.g. TEST_FAILED_UNLESS), I would ideally want to wrap the tests, and then potentially run them as child processes.
In practice though, TAP test-suite depends on a TAP test-runner. And as such the automake test-runner does notice many issues:
So at the moment using test-suite runner as a safety net is good enough, and it does what it is suppose to do. And I believe it is important to preserve current API, to enable tap output for legacy tests with no modifications to tests themselves.
So I will probably add running tests as childs, but in the tap api only (not compatible with existing TEST_#TYPE ("foo bar"))
This branch changes output:
To:
Which is in TAP format (Test Anything Protocol).
This results in automake build logs change from:
To:
Which is a more accurate and useful build-log output. Furthermore it will enable: skipping tests, marking them expected fail, marking them TODO (unimplemented features), whilst accurately reporting each one of them.
There is no break in testing API and this implementation works across all libnih tests. There is no dependency on executing the test-suite under the TAP runner.
There is one change of behaviour: instead of aborting (bailing) on test failure, a FAIL is reported and the individual test binary will "keep going". I believe this is acceptable as the overall build will fail and is accurately reported. I added a define "TEST_TAP_BAIL_ON_FAIL" which will report a TAP "bail" command and abort as it was done previously. In case one wants previous behaviour.