summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-07-09 11:40:16 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2014-07-10 18:05:33 +0100
commite16d4a2d68d163da81397ff7f1e00d063f0d700c (patch)
tree96e4c53c684727b86703dc388914c24682ab120f /lib
parent41454622506d2d060cba8c6f1cbe98a359936a2b (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 03c1f61f..bdeeb599 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -678,11 +678,17 @@ void __igt_fail_assert(int exitcode, const char *file,
{
va_list args;
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"
- "Last errno: %i, %s\n"
- "Failed assertion: %s\n",
- func, file, line, err, strerror(err), assertion);
+ "Failed assertion: %s\n"
+ "%s",
+ func, file, line, assertion, err_str ?: "");
+
+ free(err_str);
if (f) {
va_start(args, f);