summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-14 17:41:34 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-14 17:41:34 +0000
commit2a292188e764c18b76698e1698ecaf62699b2f04 (patch)
treeff66e79ac55a631bd6a65b35686ed5c54d5645bc /tests
parentceb9f7d934e7efaaf0b061c3a0c5cb4b21efa156 (diff)
tests/gem_exec_nop: silence the compiler by failing on error
gem_exec_nop.c: In function ‘exec’: gem_exec_nop.c:101:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] Propagate the failure and exit(1).
Diffstat (limited to 'tests')
-rw-r--r--tests/gem_exec_nop.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index d022c2b0..82076f0c 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -94,11 +94,11 @@ static double elapsed(const struct timeval *start,
return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec))/loop;
}
-static void exec(int fd, uint32_t handle, int loops)
+static int exec(int fd, uint32_t handle, int loops)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 exec[1];
- int ret;
+ int ret = 0;
exec[0].handle = handle;
exec[0].relocation_count = 0;
@@ -121,12 +121,14 @@ static void exec(int fd, uint32_t handle, int loops)
execbuf.rsvd1 = 0;
execbuf.rsvd2 = 0;
- while (loops--) {
+ while (loops-- && ret == 0) {
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf);
}
gem_sync(fd, handle);
+
+ return ret;
}
int main(int argc, char **argv)
@@ -145,7 +147,8 @@ int main(int argc, char **argv)
struct timeval start, end;
gettimeofday(&start, NULL);
- exec(fd, handle, count);
+ if (exec(fd, handle, count))
+ exit(1);
gettimeofday(&end, NULL);
printf("Time to exec x %d: %7.3fµs\n",
count, elapsed(&start, &end, count));