Skip to content

Commit

Permalink
added test_error_eq to show userError on assert
Browse files Browse the repository at this point in the history
For a KernelInvocationReportErrorIPC config build,
errors are suppressed and should be shown on
seL4_Error assert failures. Using this would be
no different for other config builds.
  • Loading branch information
Saer Debel committed May 11, 2020
1 parent 1f17703 commit a46a435
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libsel4test/include/sel4test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ static inline test_result_t _test_abort(const char *condition, const char *file,
return ABORT;
}

static inline void print_error_in_ipc(seL4_Error e)
{
#ifdef CONFIG_KERNEL_INVOCATION_REPORT_ERROR_IPC
// If it hasnt been printed already
if (!seL4_CanPrintError() && e != seL4_NoError) {
printf("%s", seL4_GetDebugError());
}
#endif
}

#define test_error_eq(e, c) \
if (!((e) == (c))) { \
print_error_in_ipc(e); \
return _test_fail(#e, __FILE__, __LINE__); \
}
#define test_assert(e) if (!(e)) return _test_fail(#e, __FILE__, __LINE__)
#define test_check(e) if (!(e)) _test_error(#e, __FILE__, __LINE__)
#define test_assert_fatal(e) if (!(e)) return _test_abort(#e, __FILE__, __LINE__)
Expand Down

0 comments on commit a46a435

Please sign in to comment.