igt/gem_fenced_exec_thrash: Tidy testing of expected execbuf errors

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-06-26 11:41:44 +01:00
parent c69b135783
commit f78574101f

View File

@ -145,6 +145,14 @@ static void fill_reloc(struct drm_i915_gem_relocation_entry *reloc, uint32_t han
reloc->write_domain = 0;
}
static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb)
{
int err = 0;
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb))
err = errno;
return err;
}
#define BUSY_LOAD (1 << 0)
#define INTERRUPTIBLE (1 << 1)
@ -193,24 +201,11 @@ static void run_test(int fd, int num_fences, int expected_errno,
}
do {
int ret;
if (flags & BUSY_LOAD)
emit_dummy_load();
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf[0]);
igt_assert(expected_errno ?
ret < 0 && errno == expected_errno :
ret == 0);
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf[1]);
igt_assert(expected_errno ?
ret < 0 && errno == expected_errno :
ret == 0);
igt_assert_eq(__gem_execbuf(fd, &execbuf[0]), expected_errno);
igt_assert_eq(__gem_execbuf(fd, &execbuf[1]), expected_errno);
} while (--loop);
if (flags & INTERRUPTIBLE)