[igt-dev] [PATCH i-g-t v2] i915/api_intel_allocator: fix standalone subtest

Kamil Konieczny kamil.konieczny at linux.intel.com
Tue Feb 15 12:17:23 UTC 2022


Subtest standalone uses igt_fork macro and after that makes
checks of work done by children processes, but this macro start
counting from zero, it never touches index 2. Correct indicies,
comment and asserts accordingly.
  This wasn't observed in CI due to HIGH_TO_LOW strategy used as
default in allocator so first obtained offset was never zero.

v2: correct comment, indices and checks (Zbigniew review)

Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 tests/i915/api_intel_allocator.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
index 6d7764ca..bb1b3838 100644
--- a/tests/i915/api_intel_allocator.c
+++ b/tests/i915/api_intel_allocator.c
@@ -313,10 +313,10 @@ static void standalone(int fd)
 
 	igt_fork(child, 2) {
 		/*
-		 * Use standalone allocator for child 1, detach from parent,
-		 * child 2 use allocator from parent.
+		 * Use standalone allocator for child 0, detach from parent,
+		 * child 1 use allocator from parent.
 		 */
-		if (child == 1)
+		if (child == 0)
 			intel_allocator_init();
 
 		ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_SIMPLE);
@@ -326,8 +326,8 @@ static void standalone(int fd)
 		intel_allocator_close(ahnd);
 	}
 	igt_waitchildren();
-	igt_assert_eq(offset, shared[1]);
-	igt_assert_neq(offset, shared[2]);
+	igt_assert_eq(offset, shared[0]);
+	igt_assert_neq(offset, shared[1]);
 
 	intel_allocator_free(ahnd, handle);
 	igt_assert_eq(intel_allocator_close(ahnd), true);
-- 
2.32.0



More information about the igt-dev mailing list