[Intel-gfx] [PATCH i-g-t] tests/perf_pmu: Make the invalid-init failure place more obvious

Tvrtko Ursulin tursulin at ursulin.net
Wed Nov 22 20:49:58 UTC 2017


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Put the values into the assert so we know which step failed.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 tests/perf_pmu.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 17f0afca6fe1..14eeee43c55c 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -736,7 +736,6 @@ queued(int gem_fd, const struct intel_execution_engine2 *e)
 static void invalid_init(void)
 {
 	struct perf_event_attr attr;
-	int pid, cpu;
 
 #define ATTR_INIT() \
 do { \
@@ -748,21 +747,15 @@ do { \
 
 	ATTR_INIT();
 	attr.sample_period = 100;
-	pid = -1;
-	cpu = 0;
-	igt_assert_eq(perf_event_open(&attr, pid, cpu, -1, 0), -1);
+	igt_assert_eq(perf_event_open(&attr, -1, 0, -1, 0), -1);
 	igt_assert_eq(errno, EINVAL);
 
 	ATTR_INIT();
-	pid = 0;
-	cpu = 0;
-	igt_assert_eq(perf_event_open(&attr, pid, cpu, -1, 0), -1);
+	igt_assert_eq(perf_event_open(&attr, 0, 0, -1, 0), -1);
 	igt_assert_eq(errno, EINVAL);
 
 	ATTR_INIT();
-	pid = -1;
-	cpu = 1;
-	igt_assert_eq(perf_event_open(&attr, pid, cpu, -1, 0), -1);
+	igt_assert_eq(perf_event_open(&attr, -1, 1, -1, 0), -1);
 	igt_assert_eq(errno, ENODEV);
 }
 
-- 
2.14.1



More information about the Intel-gfx mailing list