Re: [PATCH i-g-t 4/3] tests/gem_ctx_param_basic: Expand ctx_param tests

Daniel Vetter
2015-05-27T11:29:43Z

On Thu, May 21, 2015 at 12:44:53PM +0300, David Weinehall wrote:
> tests/gem_ctx_param_basic: Expand ctx_param tests
>
> Expand the context parameter tests to cover the
> no-zeromap parameter.
>
> Signed-off-by: David Weinehall <david.weinehall@intel.com>
> ---
> gem_ctx_param_basic.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/tests/gem_ctx_param_basic.c b/tests/gem_ctx_param_basic.c
> index b44b37cf0538..ba9366d1a679 100644
> --- a/tests/gem_ctx_param_basic.c
> +++ b/tests/gem_ctx_param_basic.c
> @@ -98,7 +98,7 @@ igt_main
> ctx_param.size = 0;
> }
>
> - ctx_param.param = LOCAL_CONTEXT_PARAM_BAN_PERIOD + 1;
> + ctx_param.param = I915_CONTEXT_PARAM_NO_ZEROMAP + 1;

Please respin this one with a LOCAL_ define for NO_ZEROMAP. We generally
don't want to have a hard coupling between the headers in libdrm and igt,
would mean a libdrm release roughly every week ;-)

>
> igt_subtest("invalid-param-get") {
> ctx_param.context = ctx;
> @@ -132,6 +132,28 @@ igt_main
> TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM);
> }
>
> + ctx_param.param = LOCAL_CONTEXT_PARAM_NO_ZEROMAP;
> +
> + igt_subtest("non-root-set-no-zeromap") {
> + igt_fork(child, 1) {
> + igt_drop_root();
> +
> + ctx_param.context = ctx;
> + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM);
> + ctx_param.value--;
> + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EPERM);
> + }
> +
> + igt_waitchildren();
> + }
> +
> + igt_subtest("root-set-no-zeromap") {
> + ctx_param.context = ctx;
> + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM);
> + ctx_param.value--;
> + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM);
> + }

A simple functional test here which does:
a) an execbuf with just 1 batch. With full ppgtt you should get that one
at offset 0. If not, skip the testcase.
b) set the NO_ZEROMAP property.
c) re-run the same batch, assert that now the buffer is relocated to
something non-0.

Just to make sure we have a bare minimal testcase to make sure we don't
break this.

Thanks, Daniel

> +
> igt_fixture
> close(fd);
> }
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation