tests/gem_lut_handle: Quit when we hit ENOSPC
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 27 Jun 2013 18:58:57 +0000 (19:58 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 27 Jun 2013 18:41:52 +0000 (19:41 +0100)
I'd been working under the falsehood that we would always generate an
error for an invalid reloc->target_handle before reserving any object.
However, only the execlist is checked up front for validity before
reservation so ENOSPC is a genuine error condition raised by the test.
Fix it so that we stop reporting that limit as a test failure.

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

tests/gem_lut_handle.c

index 34f886b..339e763 100644 (file)
@@ -126,7 +126,7 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign
                uint32_t target;
 
                if (flags & BROKEN) {
-                       target = -(rand() % 4096);
+                       target = -(rand() % 4096) - 1;
                } else {
                        target = rand() % (num_exec + 1);
                        if ((flags & USE_LUT) == 0)
@@ -198,6 +198,10 @@ int main(int argc, char **argv)
        fail(exec(fd, handle, USE_LUT | BROKEN));
 
        for (i = 2; i <= 65536; i *= 2) {
+               if (many_exec(fd, handle, i+1, i+1, NORMAL) == -1 &&
+                   errno == ENOSPC)
+                       break;
+
                pass(many_exec(fd, handle, i-1, i-1, NORMAL));
                pass(many_exec(fd, handle, i-1, i, NORMAL));
                pass(many_exec(fd, handle, i-1, i+1, NORMAL));