kunit: test: implement formatters for error codes
Formatters convert integer error codes to their menmonic
string representation. For example, for error code 1 we will
get string "EPERM".
Additionally this change also adds test macroses and modifies
existing macroses to use the newly introduced library where
it's appropriate, so that error messages for failed tests
contain mnemonic representations instead of just error codes.
One note about the implementation is that it basically hardcodes
mapping between error codes and their string representation. An
obvious downside of the approach is that if at some point error
codes are changed (or new error codes are introduced) the
library implementation need to be changed as well.
Assumption here that error codes do not change very often as
user space depends on values of some error codes returned by
kernel. This reasoning however doesn't apply to newly added
Signed-off-by: Mike Krinkin <email@example.com>
5 files changed