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

David Weinehall
2015-05-21T09:46:24Z

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;

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);
+ }
+
igt_fixture
close(fd);
}