Make the assertions guarding syscalls (drmIoctl in particular) verbose

Currently all we see is gem_read: ret == 0 failed, where it would help
to see the errno and/or the ret.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2012-03-29 12:45:59 +01:00
parent 9dbce0991f
commit b7bd1837cc
3 changed files with 23 additions and 29 deletions
+12
View File
@@ -71,3 +71,15 @@ void drmtest_progress(const char *header, uint64_t i, uint64_t total);
void drmtest_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
void drmtest_trash_aperture(void);
void drmtest_cleanup_aperture_trashers(void);
inline static void _do_or_die(const char *function, int line, int ret)
{
if (ret == 0)
return;
fprintf(stderr, "%s:%d failed, ret=%d, errno=%d\n",
function, line, ret, errno);
abort();
}
#define do_or_die(x) _do_or_die(__FUNCTION__, __LINE__, x)
#define do_ioctl(fd, ptr, sz) do_or_die(drmIoctl((fd), (ptr), (sz)))