Hi!
It's just a small example how things could be. Draft, not meant to be really merged. But instead of defining shell library (with more useful helpers), I'd rather adopt LTP shell [1] and C [2] API to kselftest. LTP API [1] is more like a framework, easy to use with a lot of helpers making tests 1) small, concentrating on the problem itself 2) have unique output. API is well documented [3] [4], it's creator Cyril Hrubis made it after years experience of handling (at the time) quite bad quality LTP code. Rewriting LTP tests to use this API improved tests a lot (less buggy, easier to read).
Some examples of advantages of LTP API:
- SAFE_*() macros for C, which handles errors inside a library
- unified messages, unified test status, unified way to exit testing due
missing functionality, at the end of testing there is summary of passed, failed and skipped tests
- many prepared functionality for both C and shell
- handling threads, parent-child synchronization
- setup and cleanup functions
- "flags" for defining requirements or certain functionality (need root, temporary
directory, ...)
- and many other
I guess that I can help to create a library with a subset of LTP C API that could be used to implement C tests if that is something that has a good chance to get adopted.