Skip to content

Commit cf0d014

Browse files
committed
runtimetest: Make TAP output more granular
Granular TAP output makes it easier to see what's being tested (and what's going wrong). You could feed this into any TAP harness you like, but I've chosen prove (it seems popular). You need a TAP harness looking for test failures, because runtimetest now returns zero when it successfully runs the tests (regardless of whether the tests all pass). With this commit, runtimetest will exit zero when it can successfully *run the tests* (regardless of whether all the tests pass). A TAP harness like prove should be used to consume the output TAP to decide if validation succeeded or not. To avoid confusing the TAP consumer, all of the non-TAP logging goes to stderr (and not stdout). Signed-off-by: W. Trevor King <[email protected]>
1 parent 7d409aa commit cf0d014

File tree

3 files changed

+206
-247
lines changed

3 files changed

+206
-247
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ INFO[0000] Bundle validation succeeded.
2929

3030
## Testing OCI runtimes
3131

32-
```sh
32+
You can run [`test_runtime.sh`][test_runtime.sh] with any [TAP consumer][tap-consumer].
33+
For example, with [prove][]:
34+
35+
```
3336
$ make
3437
$ sudo make install
35-
$ sudo ./test_runtime.sh -r runc
36-
-----------------------------------------------------------------------------------
37-
VALIDATING RUNTIME: runc
38-
-----------------------------------------------------------------------------------
39-
validating container process
40-
validating capabilities
41-
validating hostname
42-
validating rlimits
43-
validating sysctls
44-
Runtime runc passed validation
38+
$ sudo prove ./test_runtime.sh -r /usr/bin/runc
39+
./test_runtime.sh .. ok
40+
All tests successful.
41+
Files=1, Tests=90, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.04 cusr 0.00 csys = 0.06 CPU)
42+
Result: PASS
4543
```
4644

4745
[bundle]: https://github.com/opencontainers/runtime-spec/blob/master/bundle.md
4846
[config.json]: https://github.com/opencontainers/runtime-spec/blob/master/config.md
47+
[prove]: http://perldoc.perl.org/prove.html
4948
[runC]: https://github.com/opencontainers/runc
5049
[runtime-spec]: https://github.com/opencontainers/runtime-spec
50+
[tap-consumer]: https://testanything.org/consumers.html
5151

5252
[generate.1]: man/oci-runtime-tool-generate.1.md
5353
[validate.1]: man/oci-runtime-tool-validate.1.md

0 commit comments

Comments
 (0)