[Intel-gfx] [CI 3/5] igt/gem_workarounds: Also test new fd (implicit default context)
Mika Kuoppala
mika.kuoppala at linux.intel.com
Wed Oct 4 13:42:53 UTC 2017
Chris Wilson <chris at chris-wilson.co.uk> writes:
> 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 at chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> ---
> tests/gem_workarounds.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c
> index c252133f..1c514a62 100644
> --- a/tests/gem_workarounds.c
> +++ b/tests/gem_workarounds.c
> @@ -164,11 +164,25 @@ static int workaround_fail_count(int fd)
> 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 FDS 0x2
> static void check_workarounds(int fd, enum operation op, unsigned int flags)
> {
> uint32_t ctx = 0;
>
> + if (flags & FDS)
> + fd = reopen(fd);
> if (flags & CONTEXT)
> ctx = gem_context_create(fd);
>
> @@ -194,6 +208,8 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags)
>
> if (ctx)
> gem_context_destroy(fd, ctx);
> + if (flags & FDS)
> + close(fd);
> }
>
> igt_main
> @@ -244,15 +260,24 @@ igt_main
> igt_subtest("basic-read-context")
> check_workarounds(device, SIMPLE_READ, CONTEXT);
>
> + igt_subtest("basic-read-fd")
> + check_workarounds(device, SIMPLE_READ, FDS);
> +
> 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, FDS);
> +
> 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, FDS);
> }
> --
> 2.14.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list