test: add errno check macros

This commit is contained in:
Peter Hutterer 2021-06-04 15:23:51 +10:00
parent 2073269f47
commit 50180532a4
3 changed files with 57 additions and 0 deletions

View file

@ -226,6 +226,17 @@ void _pwtest_fail_comparison_bool(const char *file, int line, const char *func,
exit(PWTEST_FAIL);
}
SPA_NORETURN
void _pwtest_fail_errno(const char *file, int line, const char *func,
int expected, int err_no)
{
pwtest_log("FAILED ERRNO CHECK: expected %d (%s), got %d (%s)\n",
expected, strerror(expected), err_no, strerror(err_no));
pwtest_log("in %s() (%s:%d)\n", func, file, line);
pwtest_backtrace(0);
exit(PWTEST_FAIL);
}
SPA_NORETURN
void _pwtest_fail_comparison_int(const char *file, int line, const char *func,