summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-09-29 09:50:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-10-05 13:05:26 +0100
commitc5b4eaa82b2f4bdd37a1ebbff0236a157209f412 (patch)
tree0e1eb141c5d87681506c0639008085b1004e32d2
parent023477d10994d39de9f84e3a03b5fc934b0b5a3a (diff)
igt/gem_workarounds: Also test new fd (implicit default context)
To complete the picture also test a new fd with its implicit default context. Now we have a test for a longstanding fd, new client, new context. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
-rw-r--r--tests/gem_workarounds.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c
index 52801ccc..99ae1782 100644
--- a/tests/gem_workarounds.c
+++ b/tests/gem_workarounds.c
@@ -168,11 +168,25 @@ static int workaround_fail_count(int fd, uint32_t ctx)
return fail_count;
}
+static int reopen(int fd)
+{
+ char path[256];
+
+ snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
+ fd = open(path, O_RDWR);
+ igt_assert_lte(0, fd);
+
+ return fd;
+}
+
#define CONTEXT 0x1
+#define FD 0x2
static void check_workarounds(int fd, enum operation op, unsigned int flags)
{
uint32_t ctx = 0;
+ if (flags & FD)
+ fd = reopen(fd);
if (flags & CONTEXT)
ctx = gem_context_create(fd);
@@ -198,6 +212,8 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags)
if (flags & CONTEXT)
gem_context_destroy(fd, ctx);
+ if (flags & FD)
+ close(fd);
}
igt_main
@@ -248,15 +264,24 @@ igt_main
igt_subtest("basic-read-context")
check_workarounds(device, SIMPLE_READ, CONTEXT);
+ igt_subtest("basic-read-fd")
+ check_workarounds(device, SIMPLE_READ, FD);
+
igt_subtest("reset")
check_workarounds(device, GPU_RESET, 0);
igt_subtest("reset-context")
check_workarounds(device, GPU_RESET, CONTEXT);
+ igt_subtest("reset-fd")
+ check_workarounds(device, GPU_RESET, FD);
+
igt_subtest("suspend-resume")
check_workarounds(device, SUSPEND_RESUME, 0);
igt_subtest("suspend-resume-context")
check_workarounds(device, SUSPEND_RESUME, CONTEXT);
+
+ igt_subtest("suspend-resume-fd")
+ check_workarounds(device, SUSPEND_RESUME, FD);
}