[Intel-gfx] [PATCH 1/1] tests/gem_reset_stats: EPERM check not needed

Mika Kuoppala mika.kuoppala at linux.intel.com
Fri May 2 13:16:28 CEST 2014


Without root we used to get EPERM if we tried to aquire
default context statistics. Now we have per fd statistics
so only thing which is hidden from us without root access,
is the global reset count.

Drop EPERM and check that global reset count is always zero
for nonroot.

Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
 tests/gem_reset_stats.c |   30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index c227798..898f696 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -913,11 +913,7 @@ static void test_reset_count(const bool create_ctx)
 		igt_drop_root();
 
 		c2 = get_reset_count(fd, ctx);
-
-		if (ctx == 0)
-			igt_assert(c2 == -EPERM);
-		else
-			igt_assert(c2 == 0);
+		igt_assert(c2 == 0);
 	}
 
 	igt_waitchildren();
@@ -952,45 +948,37 @@ static int _test_params(int fd, int ctx, uint32_t flags, uint32_t pad)
 	return 0;
 }
 
-typedef enum { root = 0, user } cap_t;
-
-static void _check_param_ctx(const int fd, const int ctx, const cap_t cap)
+static void _check_param_ctx(const int fd, const int ctx)
 {
 	const uint32_t bad = rand() + 1;
 
-	if (ctx == 0) {
-		if (cap == root)
-			igt_assert(_test_params(fd, ctx, 0, 0) == 0);
-		else
-			igt_assert(_test_params(fd, ctx, 0, 0) == -EPERM);
-	}
-
+	igt_assert(_test_params(fd, ctx, 0, 0) == 0);
 	igt_assert(_test_params(fd, ctx, 0, bad) == -EINVAL);
 	igt_assert(_test_params(fd, ctx, bad, 0) == -EINVAL);
 	igt_assert(_test_params(fd, ctx, bad, bad) == -EINVAL);
 }
 
-static void check_params(const int fd, const int ctx, cap_t cap)
+static void check_params(const int fd, const int ctx)
 {
 	igt_assert(ioctl(fd, GET_RESET_STATS_IOCTL, 0) == -1);
 	igt_assert(_test_params(fd, 0xbadbad, 0, 0) == -ENOENT);
 
-	_check_param_ctx(fd, ctx, cap);
+	_check_param_ctx(fd, ctx);
 }
 
 static void _test_param(const int fd, const int ctx)
 {
-	check_params(fd, ctx, root);
+	check_params(fd, ctx);
 
 	igt_fork(child, 1) {
-		check_params(fd, ctx, root);
+		check_params(fd, ctx);
 
 		igt_drop_root();
 
-		check_params(fd, ctx, user);
+		check_params(fd, ctx);
 	}
 
-	check_params(fd, ctx, root);
+	check_params(fd, ctx);
 
 	igt_waitchildren();
 }
-- 
1.7.9.5




More information about the Intel-gfx mailing list