mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 16:36:14 +00:00
core: Apply the same treatment to the in errno message in __igt_fail_assert()
Just like the it was done for the requirement message, display the errno message only if errno is set, and display it at the end of the assert message. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
parent
4145462250
commit
e16d4a2d68
@ -678,11 +678,17 @@ void __igt_fail_assert(int exitcode, const char *file,
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int err = errno;
|
int err = errno;
|
||||||
|
char *err_str = NULL;
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
|
||||||
|
|
||||||
printf("Test assertion failure function %s, file %s:%i:\n"
|
printf("Test assertion failure function %s, file %s:%i:\n"
|
||||||
"Last errno: %i, %s\n"
|
"Failed assertion: %s\n"
|
||||||
"Failed assertion: %s\n",
|
"%s",
|
||||||
func, file, line, err, strerror(err), assertion);
|
func, file, line, assertion, err_str ?: "");
|
||||||
|
|
||||||
|
free(err_str);
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
va_start(args, f);
|
va_start(args, f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user