tests/gem_lut_handle: Simplify creation of broken handles
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 24 Jun 2013 12:53:44 +0000 (13:53 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 24 Jun 2013 12:55:53 +0000 (13:55 +0100)
Limit the broken handles to UINT32_MAX-4096 so that we can be sure that
they do not alias with a valid handle.

References: https://bugs.freedesktop.org/show_bug.cgi?id=65391
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
tests/gem_lut_handle.c

index d755e43..34f886b 100644 (file)
@@ -123,12 +123,10 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign
        max_handle++;
 
        for (n = 0; n < num_reloc; n++) {
-               unsigned target;
+               uint32_t target;
 
                if (flags & BROKEN) {
-                       target = rand();
-                       if (target <= max_handle)
-                               target = target & 1 ? -target : max_handle + target;
+                       target = -(rand() % 4096);
                } else {
                        target = rand() % (num_exec + 1);
                        if ((flags & USE_LUT) == 0)