From f1e9e300fa82181182e2e92ccce078682829a3a2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 5 Jun 2013 11:10:04 +0100 Subject: [PATCH] gem_lut_handle: Make the error checking explicit for LUT handling What this test is interested in is the handling of the LUT for very large arrays, irrespective of whether such batch are actually executable. So adjust the pass/fail checks to be explicit in the error they are looking for, so that we do not conflate memory/aperture pressure as a failure in the LUT API. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65391 Signed-off-by: Chris Wilson --- tests/gem_lut_handle.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tests/gem_lut_handle.c b/tests/gem_lut_handle.c index a051003e..c31c5ffc 100644 --- a/tests/gem_lut_handle.c +++ b/tests/gem_lut_handle.c @@ -171,7 +171,9 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign return ret; } -#define fail(x) assert(x == -1 && errno == ENOENT) +#define _fail(x) ((x) == -1 && errno == ENOENT) +#define fail(x) assert(_fail(x)) +#define pass(x) assert(!_fail(x)) int main(int argc, char **argv) { @@ -194,15 +196,15 @@ int main(int argc, char **argv) fail(exec(fd, handle, USE_LUT | BROKEN)); for (i = 2; i <= 65536; i *= 2) { - do_or_die(many_exec(fd, handle, i-1, i-1, NORMAL)); - do_or_die(many_exec(fd, handle, i-1, i, NORMAL)); - do_or_die(many_exec(fd, handle, i-1, i+1, NORMAL)); - do_or_die(many_exec(fd, handle, i, i-1, NORMAL)); - do_or_die(many_exec(fd, handle, i, i, NORMAL)); - do_or_die(many_exec(fd, handle, i, i+1, NORMAL)); - do_or_die(many_exec(fd, handle, i+1, i-1, NORMAL)); - do_or_die(many_exec(fd, handle, i+1, i, NORMAL)); - do_or_die(many_exec(fd, handle, i+1, i+1, NORMAL)); + 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)); + pass(many_exec(fd, handle, i, i-1, NORMAL)); + pass(many_exec(fd, handle, i, i, NORMAL)); + pass(many_exec(fd, handle, i, i+1, NORMAL)); + 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)); fail(many_exec(fd, handle, i-1, i-1, NORMAL | BROKEN)); fail(many_exec(fd, handle, i-1, i, NORMAL | BROKEN)); @@ -214,15 +216,15 @@ int main(int argc, char **argv) fail(many_exec(fd, handle, i+1, i, NORMAL | BROKEN)); fail(many_exec(fd, handle, i+1, i+1, NORMAL | BROKEN)); - do_or_die(many_exec(fd, handle, i-1, i-1, USE_LUT)); - do_or_die(many_exec(fd, handle, i-1, i, USE_LUT)); - do_or_die(many_exec(fd, handle, i-1, i+1, USE_LUT)); - do_or_die(many_exec(fd, handle, i, i-1, USE_LUT)); - do_or_die(many_exec(fd, handle, i, i, USE_LUT)); - do_or_die(many_exec(fd, handle, i, i+1, USE_LUT)); - do_or_die(many_exec(fd, handle, i+1, i-1, USE_LUT)); - do_or_die(many_exec(fd, handle, i+1, i, USE_LUT)); - do_or_die(many_exec(fd, handle, i+1, i+1, USE_LUT)); + pass(many_exec(fd, handle, i-1, i-1, USE_LUT)); + pass(many_exec(fd, handle, i-1, i, USE_LUT)); + pass(many_exec(fd, handle, i-1, i+1, USE_LUT)); + pass(many_exec(fd, handle, i, i-1, USE_LUT)); + pass(many_exec(fd, handle, i, i, USE_LUT)); + pass(many_exec(fd, handle, i, i+1, USE_LUT)); + pass(many_exec(fd, handle, i+1, i-1, USE_LUT)); + pass(many_exec(fd, handle, i+1, i, USE_LUT)); + pass(many_exec(fd, handle, i+1, i+1, USE_LUT)); fail(many_exec(fd, handle, i-1, i-1, USE_LUT | BROKEN)); fail(many_exec(fd, handle, i-1, i, USE_LUT | BROKEN));