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

David Weinehall
2015-05-28T12:22:21Z

On Wed, May 27, 2015 at 01:32:10PM +0200, Daniel Vetter wrote:
> 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 ;-)

Oh, sorry, that was a typo, will fix.

> >
> > 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.

OK, will add that -- thanks for the input.

Kind regards, David