From c1404e05b7477122b9923ba029593c2cb64671a7 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 29 Apr 2014 07:14:33 +0100 Subject: [PATCH] errno is reset after each syscall Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78055 Bugilla: https://bugs.freedesktop.org/show_bug.cgi?id=78053 Signed-off-by: Chris Wilson --- tests/gem_exec_bad_domains.c | 3 +-- tests/gem_lut_handle.c | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c index 6fb9edb..7641f8f 100644 --- a/tests/gem_exec_bad_domains.c +++ b/tests/gem_exec_bad_domains.c @@ -141,11 +141,10 @@ static void multi_write_domain(int fd) ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf); + igt_assert(ret != 0 && errno == EINVAL); gem_close(fd, handle); gem_close(fd, handle_target); - - igt_assert(ret != 0 && errno == EINVAL); } int fd; diff --git a/tests/gem_lut_handle.c b/tests/gem_lut_handle.c index e682ccf..705e8b3 100644 --- a/tests/gem_lut_handle.c +++ b/tests/gem_lut_handle.c @@ -154,6 +154,8 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf); + if (ret < 0) + ret = -errno; for (n = 0; n < num_exec; n++) gem_close(fd, gem_exec[n].handle); @@ -164,7 +166,7 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign return ret; } -#define _fail(x) ((x) == -1 && errno == ENOENT) +#define _fail(x) ((x) == -ENOENT) #define ASSERT(x) do { \ if (!(x)) { \ fprintf(stderr, "%s:%d failed, errno=%d\n", \ @@ -195,8 +197,7 @@ igt_simple_main fail(exec(fd, handle, USE_LUT | BROKEN)); for (i = 2; i <= SLOW_QUICK(65536, 8); i *= 2) { - if (many_exec(fd, handle, i+1, i+1, NORMAL) == -1 && - errno == ENOSPC) + if (many_exec(fd, handle, i+1, i+1, NORMAL) == -ENOSPC) break; pass(many_exec(fd, handle, i-1, i-1, NORMAL)); -- 2.7.4