-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/runtimetest/main: Use TAP diagnostics for errors #439
Conversation
This doesn't save much time for folks who are iterating over the removed errors (e.g. to print warnings about them), but Aleksa asked for it [1]. I haven't used it in runtimetest. I'm waiting for the in-flight 7aa3987 (cmd/runtimetest/main: Use TAP diagnostics for errors, 2017-07-28, opencontainers#439) to settle, since that commit cleans up some of the runtimetest error-processing code with: validations := defaultValidations if platform == "linux" { validations = append(validations, linuxValidations...) } and a single loop over the constructed validations array. [1]: opencontainers#492 (comment) Signed-off-by: W. Trevor King <[email protected]>
This doesn't save much time for folks who are iterating over the removed errors (e.g. to print warnings about them), but Aleksa asked for it [1]. I haven't used it in runtimetest. I'm waiting for the in-flight 7aa3987 (cmd/runtimetest/main: Use TAP diagnostics for errors, 2017-07-28, opencontainers#439) to settle, since that commit cleans up some of the runtimetest error-processing code with: validations := defaultValidations if platform == "linux" { validations = append(validations, linuxValidations...) } and a single loop over the constructed validations array. I initially had FilterError returning (filtered, removed), but golint didn't like that: error should be the last type when returning multiple items [1]: opencontainers#492 (comment) Signed-off-by: W. Trevor King <[email protected]>
This doesn't save much time for folks who are iterating over the removed errors (e.g. to print warnings about them), but Aleksa asked for it [1]. I haven't used it in runtimetest. I'm waiting for the in-flight 7aa3987 (cmd/runtimetest/main: Use TAP diagnostics for errors, 2017-07-28, opencontainers#439) to settle, since that commit cleans up some of the runtimetest error-processing code with: validations := defaultValidations if platform == "linux" { validations = append(validations, linuxValidations...) } and a single loop over the constructed validations array. I initially had FilterError returning (filtered, removed), but golint didn't like that: error should be the last type when returning multiple items [1]: opencontainers#492 (comment) Signed-off-by: W. Trevor King <[email protected]>
This doesn't save much time for folks who are iterating over the removed errors (e.g. to print warnings about them), but Aleksa asked for it [1] and Ma suggested the helper struct [2]. I haven't used it in runtimetest. I'm waiting for the in-flight 7aa3987 (cmd/runtimetest/main: Use TAP diagnostics for errors, 2017-07-28, opencontainers#439) to settle, since that commit cleans up some of the runtimetest error-processing code with: validations := defaultValidations if platform == "linux" { validations = append(validations, linuxValidations...) } and a single loop over the constructed validations array. [1]: opencontainers#492 (comment) [2]: opencontainers#492 (comment) Signed-off-by: W. Trevor King <[email protected]>
@wking can you rebase this PR? If the PR is not ready to merge, it's a little hard for us to review. |
I'll try to rebase tomorrow, but the PR topic message should have sufficient detail to review the user impact. If you feel it doesn't, what more information would you like? |
If your PR is not ready for merging, I think most reviewers will not have interest to review it. |
This lets us print SHOULD violations even if they're non-fatal. It also gets us back to consumable TAP output. I added a /foo entry to defaultFS for testing, and before this commit: $ ./runtimetest TAP version 13 not ok 1 - root filesystem ok 2 - hostname not ok 3 - process not ok 4 - mounts not ok 5 - user ok 6 - rlimits ok 7 - capabilities ok 8 - default symlinks ok 9 - default file system ok 10 - default devices ok 11 - linux devices not ok 12 - linux process ok 13 - masked paths ok 14 - oom score adj ok 15 - read only paths ok 16 - rootfs propagation ok 17 - sysctls ok 18 - uid mappings ok 19 - gid mappings 1..19 6 errors occurred: * rootfs must not be readonly Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#root * Cwd expected: /, actual: /home/wking/.local/lib/go/src/github.com/opencontainers/runtime-tools * mounts[1] {/tmp tmpfs none []} does not exist Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts * mounts[2] {/dev devtmpfs devtmpfs []} mounted before mounts[0] {/tmp tmpfs none []} Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts * UID expected: 1, actual: 1000 * Process arguments expected: ./runtimetest, actual: sh $ echo $? 1 The TAP 13 spec doesn't cover script exit-code handling [1], but that exit code confuses prove unless you set --ignore-exit: $ prove ./runtimetest ./runtimetest .. 1/? 6 errors occurred: * rootfs must not be readonly Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#root * Cwd expected: /, actual: /home/wking/.local/lib/go/src/github.com/opencontainers/runtime-tools * mounts[1] {/tmp tmpfs none []} does not exist Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts * mounts[2] {/dev devtmpfs devtmpfs []} mounted before mounts[0] {/tmp tmpfs none []} Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts * UID expected: 1, actual: 1000 * Process arguments expected: ./runtimetest, actual: sh ./runtimetest .. Dubious, test returned 1 (wstat 256, 0x100) Failed 5/19 subtests Test Summary Report ------------------- ./runtimetest (Wstat: 256 Tests: 19 Failed: 5) Failed tests: 1, 3-5, 12 Non-zero exit status: 1 Files=1, Tests=19, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Result: FAIL Note the "Dubious, test returned 1". And with the diagnostics written to stderr, there's no way to have prove catch that. With this commit, we're back to TAP-compatible output and exit codes, using TAP's diagnostics [2] to share the failure details. $ ./runtimetest TAP version 13 not ok 1 - root filesystem # rootfs must not be readonly # Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#root ok 2 - hostname not ok 3 - process # Cwd expected: /, actual: /home/wking/.local/lib/go/src/github.com/opencontainers/runtime-tools not ok 4 - mounts # mounts[1] {/tmp tmpfs none []} does not exist # Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts not ok 5 - mounts # mounts[2] {/dev devtmpfs devtmpfs []} mounted before mounts[0] {/tmp tmpfs none []} # Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts not ok 6 - user # UID expected: 1, actual: 1000 ok 7 - rlimits ok 8 - capabilities ok 9 - default symlinks ok 10 - default file system ok 11 - default devices ok 12 - linux devices not ok 13 - linux process # Process arguments expected: ./runtimetest, actual: sh ok 14 - masked paths ok 15 - oom score adj ok 16 - read only paths ok 17 - rootfs propagation ok 18 - sysctls ok 19 - uid mappings ok 20 - gid mappings 1..20 $ echo $? 0 You can use prove without --ignore-edit to summarize: $ prove ./runtimetest ./runtimetest .. Failed 6/20 subtests Test Summary Report ------------------- ./runtimetest (Wstat: 0 Tests: 20 Failed: 6) Failed tests: 1, 3-6, 13 Files=1, Tests=20, 0 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 CPU) Result: FAIL And prove knows that the tests failed from TAP, with the script exit code saying "we were able to run the tests" and not speaking to pass/fail: $ echo $? 1 If that's too compact, you can ask prove to show failures and comments: $ prove -fo ./runtimetest ./runtimetest .. 1/? not ok 1 - root filesystem # rootfs must not be readonly # Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#root not ok 3 - process # Cwd expected: /, actual: /home/wking/.local/lib/go/src/github.com/opencontainers/runtime-tools not ok 4 - mounts # mounts[1] {/tmp tmpfs none []} does not exist # Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts not ok 5 - mounts # mounts[2] {/dev devtmpfs devtmpfs []} mounted before mounts[0] {/tmp tmpfs none []} # Refer to: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#mounts not ok 6 - user # UID expected: 1, actual: 1000 not ok 13 - linux process # Process arguments expected: ./runtimetest, actual: sh ./runtimetest .. Failed 6/20 subtests Test Summary Report ------------------- ./runtimetest (Wstat: 0 Tests: 20 Failed: 6) Failed tests: 1, 3-6, 13 Files=1, Tests=20, 0 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 CPU) Result: FAIL You can also turn that SHOULD error into a failure by cranking up the compliance level: $ prove -fo ./runtimetest :: --compliance-level SHOULD although I don't have any interesting SHOULD violations between my test config.json and my host system. [1]: https://testanything.org/tap-version-13-specification.html#todo [2]: https://testanything.org/tap-version-13-specification.html#diagnostics Signed-off-by: W. Trevor King <[email protected]>
9fe8199
to
9422eec
Compare
On Wed, Nov 22, 2017 at 06:35:02AM +0000, Ma Shimiao wrote:
Keep PR ready for reviewing, I think that's the basic we need to do.
Rebased with 9fe8199 → 9422eec.
But I think that's a pretty stiff requirement for a PR that's been
open for four months. There doesn't seem to be much point in things
like #266's multiple rebase requests [1,2,3] if the PR is not going to
get enough review to be merged or rejected after the rebase.
I don't see why maintainers would be unwilling to state a position on
the general thrust even if the PR has gone slightly stale. This sort
of preliminary review would just cover API/UI changes; I don't expect
mainainers to spend time looking at stale code. If the maintainer
positions were negative, we could reject the PR without bothering to
rebase it. And if the maintainer positions were positive, we'd have a
short list of maintainers to ping for final, post-rebase LGTMs,
hopefully landing the PR before something else landed and made it
stale again.
Or maybe there are other approaches that would help avoid the repeated
rebases without a merge or rejection? Sorting PRs in a queue like
we're somewhat doing with milestones helps. But the most recent PR to
conflict with this one was #510, and both this PR and #510 are in
v0.4.0 [4]. I'm open to other busywork-reduction ideas if the
maintainers have something in mind.
[1]: #266 (comment)
[2]: #266 (comment)
[3]: #266 (comment)
[4]: https://github.com/opencontainers/runtime-tools/milestone/6
|
@wking I'm sorry about that if review process makes you unhappy. |
On Fri, Nov 24, 2017 at 06:01:12AM +0000, Ma Shimiao wrote:
@wking I'm sorry about that if review process makes you unhappy.
It mostly works out ok. The multiple-rebase thing is just a place
where I think there's room for improvement.
We should consider old PRs first if there are not other PRs in
higher priority.
That would help sort within milestones. Serializing review like that
may slow things down, because if the fist-in-queue PR blocks (for any
reason, could be either a maintainer or submitter delay) that holds up
later PRs. Maybe a soft serialization? “For the current milestone,
consider if *you* are blocking the oldest PR before merging a later
PR” or something like that?
|
On 11/24/2017 02:30 PM, W. Trevor King wrote:
That would help sort within milestones. Serializing review like that
may slow things down, because if the fist-in-queue PR blocks (for any
reason, could be either a maintainer or submitter delay) that holds up
later PRs. Maybe a soft serialization? “For the current milestone,
consider if *you* are blocking the oldest PR before merging a later
PR” or something like that?
I think that makes sense.
|
I'm OK with using t.Diagnostic(). But I think there is a problem, there is not
I think that's not so suitable, because the result is opposite with fact. |
I see two possible solutions: a. Drop my change to the exit code, and expect folks who do use I'm fine with (a) if folks want a short-term fix, but I think (b) is a better long-term approach (e.g. it allows easily tunable verbosity for #308). I'm fine working up either, or other alternatives, as part of this PR. |
considering #308, I prefer b. Ping @opencontainers/runtime-tools-maintainers |
The generate package already imports the validate package, so this isn't creating an import cycle. And as a generation smoke test, this doesn't belong in validation (which is about compliance-testing runtimes). Signed-off-by: W. Trevor King <[email protected]>
On Fri, Nov 24, 2017 at 07:27:29AM +0000, Ma Shimiao wrote:
considering #308, I prefer b.
Done with 9422eec → b2677cb; I can stash the new commits for later if
the maintainer consensus is to punt on (b) for now.
The new implementation is ignoring the runtimetest TAP output and
error code, but that's nothing new. Master has been ignoring them
since #447 [1]. Once the container type gains a method like runc's
‘run’ (to create, start, wait on exit, and delete), we can use that in
RuntimeInsideValidate to fix the broken tests.
[1]: #447 (comment)
|
+1 for the |
@Mashimiao @q384566678 I merged 3 minor fixes just now and I think we would better stop working on other PRs until we merging this one and #308. |
I also want this PR landed as soon as possible. |
b2677cb
to
b2c08bf
Compare
@wking I think @liangchenye has found the root cause, would you like to update the PR? |
I've been working on it, but don't have everything fixed yet. Maybe by tonight or tomorrow. |
Got it, thanks. |
3f9cb51
to
87af1d1
Compare
Ok, updated with 3f9cb51 → 72a957c.
There's still a FIXME sleep in there, but as long as runtimetest takes
less than a second we can punt on a real fix. And folks in a hurry
can run prove with ‘-j 50’ or whatever to parallelize the sleeps.
And there are a few tests failing for other reasons with poor error
messages, like:
$ sudo RUNTIME=runc validation/linux_gid_mappings.t
…
not ok 19 - gid mappings
# linux.gidMappings is not applied as expected
…
which I haven't had time to look into yet.
|
It seems except container created failed, other the failed reasons are not output? |
On Thu, Nov 30, 2017 at 06:35:24AM +0000, Ma Shimiao wrote:
validation/linux_rootfs_propagation_unbindable.t .. failed to create the container
rootfsPropagation=unbindable is not supported
exit status 1
validation/linux_rootfs_propagation_unbindable.t .. Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
validation/linux_readonly_paths.t ................. ok
validation/linux_masked_paths.t ................... Failed 1/19 subtests
```
It seems except container created failed…
Create errors are currently outside of TAP, because I'm leaving TAP up
to runtimetest. And creation errors are currently not really
compliance failures anyway. For example,
“rootfsPropagation=unbindable is not supported” is a legal runtime
reaction based on [1] (although you have
opencontainers/runtime-spec#813 trying to get that addressed and I
have opencontainers/runtime-spec#927 addressing part of it). Anyway,
with the current spec we may want mini-TAP output on create failures
like:
TAP version 13
1..1
ok 1 # SKIP create container with unbindable linux.rootfsPropagation
# rootfsPropagation=unbindable is not supported
# exit status 1
for create failures.
… other the failed reasons are not output?
You can tell prove how much detail you're interested in [2]. For example:
$ sudo RUNTIME=runc prove -fo --directives validation/create.t validation/mounts.t
validation/create.t .. 1/?
# https://github.com/opencontainers/runtime-spec/blob/v1.0.0/runtime.md#create
# exit status 1
# /home/wking/bin/runc: "create" requires exactly 1 argument(s)
# https://github.com/opencontainers/runtime-spec/blob/v1.0.0/runtime.md#create
# container PID: %!d(string=478dfbf9-68bb-488c-8b16-1d12c41b5e98), state ID: %!d(string=478dfbf9-68bb-488c-8b16-1d12c41b5e98)
# https://github.com/opencontainers/runtime-spec/blob/v1.0.0/runtime.md#create
# open /tmp/ocitest715783221/stdout-478dfbf9-68bb-488c-8b16-1d12c41b5e98: file exists
validation/create.t .. ok
validation/mounts.t .. 1/?
ok 1 # SKIP TODO mounts generation options have not been implemented
validation/mounts.t .. ok
All tests successful.
Files=2, Tests=5, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.03 cusr 0.01 csys = 0.06 CPU)
Result: PASS
That is currently also showing diagnostics on success, and TAP doesn't
seem to provide a way to turn those off. Unless we can find a way to
do that (or patch prove to support it), we may want to stop printing
diagnostics unless they're related to failures. Or maybe we should
transition all of our diagnostics to YAML blocks [3]; I'll check and
see if those are supported differently.
[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L463
[2]: #308 (comment)
[3]: https://testanything.org/tap-version-13-specification.html#yaml-blocks
|
d2f506d
to
0a919c0
Compare
Capture stdout and stderr from create invocations, because we don't want to pollute the TAP output with things like runc's: Incorrect Usage. ... (which is for some reason printed to stdout) or: runc: "create" requires exactly 1 argument(s) which is printed to stderr. Instead, show the captured stderr as a diagnostic, and hide the stdout completely. Unless stderr is empty, in which case show stdout in case it contains something useful. Most of these tests are broken because we aren't collecting the container exit code or post-start stdout. But the tests haven't been doing that since the create/start split in 15577bd (add runtime struct; add create test, 2017-08-24, opencontainers#447) anyway [1]. This commit just makes that more obvious. The patsubst and wildcard Makefile syntax is documented in [2]. The $(VALIDATION_TESTS) rule uses the static pattern rule syntax [3]. And use 'console' instead of 'sh' in the README, because these are shell sessions, not scripts. See [4,5]. I don't have a working runc locally, so the mock results based on a dummy runtime script. [1]: opencontainers#447 (comment) [2]: https://www.gnu.org/software/make/manual/html_node/Wildcard-Function.html [3]: https://www.gnu.org/software/make/manual/html_node/Static-Usage.html#Static-Usage [4]: https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting [5]: https://github.com/github/linguist/blob/v5.3.3/lib/linguist/languages.yml#L4249-L4260 Signed-off-by: W. Trevor King <[email protected]>
When the container failed in creation, delete will fail, but we still want to remove the test bundle directory. Signed-off-by: W. Trevor King <[email protected]>
For better reporting, including skips. Prove (at least as of TAP::Harness v3.35_01 and Perl v5.22.3) seems to report skips only when there were also failures. For example, here's a skip-only test: $ validation/mounts.t TAP version 13 1..1 ok 1 # SKIP TODO: mounts generation options have not been implemented $ prove validation/mounts.t validation/mounts.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU) Result: PASS node-tap (as of version 11.0.0) reports that skip: $ tap validation/mounts.t validation/mounts.t ................................... 0/1 Skipped: 1 TODO: mounts generation options have not been implemented total ................................................. 0/1 0 passing (27.297ms) 1 pending And here's a skip with a failure test: $ ./test-skip TAP version 13 1..2 not ok 1 - failing ok 2 # SKIP: skipping Prove warns about the skip now: $ prove test-skip test-skip .. Failed 1/2 subtests (less 1 skipped subtest: 0 okay) Test Summary Report ------------------- test-skip (Wstat: 0 Tests: 2 Failed: 1) Failed test: 1 Files=1, Tests=2, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Result: FAIL But node-tap has a nicer warning: $ tap ./test-skip ./test-skip ........................................... 0/2 not ok failing Skipped: 1 : skipping total ................................................. 0/2 0 passing (39.088ms) 1 pending 1 failing Similarly, node-tap does a better job handling YAML blocks [1]: $ ./test-yaml TAP version 13 1..4 ok 1 - success diagnostic # success not ok 2 - failure diagnostic # failure ok 3 - success YAML --- message: success ... not ok 4 - failure YAML --- message: failure ... Prove either shows no diagnostics: $ prove test-yaml test-yaml .. Failed 2/4 subtests Test Summary Report ------------------- test-yaml (Wstat: 0 Tests: 4 Failed: 2) Failed tests: 2, 4 Files=1, Tests=4, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Result: FAIL or it shows all the diagnostics (even for successful tests): $ prove --comments test-yaml test-yaml .. 1/? # success # failure test-yaml .. Failed 2/4 subtests Test Summary Report ------------------- test-yaml (Wstat: 0 Tests: 4 Failed: 2) Failed tests: 2, 4 Files=1, Tests=4, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Result: FAIL I can't find a way to get Prove to show the YAML blocks. node-tap, on the other hand, does the right thing with YAML blocks: $ tap ./test-yaml ./test-yaml ........................................... 2/4 not ok failure diagnostic not ok failure YAML message: failure total ................................................. 2/4 2 passing (42.409ms) 2 failing We don't use YAML blocks at the moment, but I'm going to transition to them later. [1]: http://testanything.org/tap-version-13-specification.html#yaml-blocks Signed-off-by: W. Trevor King <[email protected]>
YAML-block support PR filed upstream in mndrix/tap-go#7. If/when that lands, I'll transition from |
1 similar comment
To pick up t.YAML(...) for more visible error messages. See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. Signed-off-by: W. Trevor King <[email protected]>
See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. The README's localvalidation line is back after I accidentally removed it in ad47e7d. Signed-off-by: W. Trevor King <[email protected]>
To pick up t.YAML(...) for more visible error messages. See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. Generated with: $ go get -u github.com/mndrix/tap-go $ godep update github.com/mndrix/tap-go $ emacs Godeps/Godeps.json # remove gopkg.in/yaml.v2 entry $ rm -rf vendor/gopkg.in/yaml.v2 $ git add vendor/github.com/mndrix We don't need gopkg.in/yaml.v2 because we're using tap-go's JSON output. Signed-off-by: W. Trevor King <[email protected]>
See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. The README's localvalidation line is back after I accidentally removed it in ad47e7d. Signed-off-by: W. Trevor King <[email protected]>
See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. The README's localvalidation line is back after I accidentally removed it in ad47e7d. Signed-off-by: W. Trevor King <[email protected]>
Instead of reporting total ................................................. 0/0 and passing (which node-tap seems to do when given missing files as arguments), report: missing test executable; run 'make runtimetest validation-executables' and error out. Having a separate step to build the executables is useful for: * Not building them as root, which reduces the change of security issues by using as little privilege as possible. * Not rebuilding them on each test, since we haven't told Make about the full dependency tree for the test executables. The separate build step was introduced in e11b77f (validation: Use prove(1) as a TAP harness, 2017-11-25, opencontainers#439), but I didn't do a good job of motivating it in that commit message. Signed-off-by: W. Trevor King <[email protected]>
Instead of reporting total ................................................. 0/0 and passing (which node-tap seems to do when given missing files as arguments), report: missing test executable; run 'make runtimetest validation-executables' and error out. Having a separate step to build the executables is useful for: * Not building them as root, which reduces the change of security issues by using as little privilege as possible. * Not rebuilding them on each test, since we haven't told Make about the full dependency tree for the test executables. The separate build step was introduced in e11b77f (validation: Use prove(1) as a TAP harness, 2017-11-25, opencontainers#439), but I didn't do a good job of motivating it in that commit message. Signed-off-by: W. Trevor King <[email protected]>
To pick up t.YAML(...) for more visible error messages. See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. Generated with: $ go get -u github.com/mndrix/tap-go $ godep update github.com/mndrix/tap-go $ emacs Godeps/Godeps.json # remove gopkg.in/yaml.v2 entry $ rm -rf vendor/gopkg.in/yaml.v2 $ git add vendor/github.com/mndrix We don't need gopkg.in/yaml.v2 because we're using tap-go's JSON output. Signed-off-by: W. Trevor King <[email protected]>
See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. The README's localvalidation line is back after I accidentally removed it in ad47e7d. Signed-off-by: W. Trevor King <[email protected]>
Instead of reporting total ................................................. 0/0 and passing (which node-tap seems to do when given missing files as arguments), report: missing test executable; run 'make runtimetest validation-executables' and error out. Having a separate step to build the executables is useful for: * Not building them as root, which reduces the change of security issues by using as little privilege as possible. * Not rebuilding them on each test, since we haven't told Make about the full dependency tree for the test executables. The separate build step was introduced in e11b77f (validation: Use prove(1) as a TAP harness, 2017-11-25, opencontainers#439), but I didn't do a good job of motivating it in that commit message. Signed-off-by: W. Trevor King <[email protected]>
This lets us print SHOULD violations even if they're non-fatal. It also gets us back to consumable TAP output. I added a
/foo
entry todefaultFS
for testing, and before this commit:The TAP 13 spec doesn't cover script exit-code handling, but that exit code confuses prove unless you set
--ignore-exit
:Note the “Dubious, test returned 1”. And with the diagnostics written to stderr, there's no way to have prove catch that.
With this commit, we're back to TAP-compatible output and exit codes, using TAP's diagnostics to share the failure details.
You can use prove without
--ignore-edit
to summarize:And prove knows that the tests failed from TAP, with the script exit code saying “we were able to run the tests” and not speaking to pass/fail:
If that's too compact, you can ask prove to show failures and comments:
You can also turn that SHOULD violation into a failure by cranking up the compliance level:
Fixed #362.
Related to #308 in that we're improving the TAP output and removing
go-multierror
, but otherwise unrelated to that PR.