Skip to contentSkip to conversation

tests/gem_flink_race, prime_self_import: fix object counts

PATCH In review Mika Kuoppala 2 participants 2 messages May 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_flink_race, prime_self_import: fix object counts

We need to add one drm_open_any() before getting the object counts as first call to drm_open_any() allocates file descriptors for exit handlers and thus is not symmetrical

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77867
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77875

---
 tests/gem_flink_race.c    |    8 ++++++++
 tests/prime_self_import.c |    8 ++++++++
 2 files changed, 16 insertions(+)
tests/gem_flink_race.c +8 -0
index 3353b83..f129cb3 100644
@@ -163,6 +163,11 @@ static void test_flink_close(void)
 	int r, i, num_threads;
 	int obj_count;
 	void *status;
+	int fake;
+
+	/* Allocate exit handler fds in here so that we dont screw
+	 * up the counts */
+	fake = drm_open_any();
 
 	obj_count = get_object_count();
 
@@ -193,6 +198,9 @@ static void test_flink_close(void)
 	obj_count = get_object_count() - obj_count;
 
 	printf("leaked %i objects\n", obj_count);
+
+	close(fake);
+
 	igt_assert(obj_count == 0);
 }
 
tests/prime_self_import.c +8 -0
index efdd24f..41c203f 100644
@@ -258,6 +258,11 @@ static void test_reimport_close_race(void)
 	int obj_count;
 	void *status;
 	uint32_t handle;
+	int fake;
+
+	/* Allocate exit handler fds in here so that we dont screw
+	 * up the counts */
+	fake = drm_open_any();
 
 	obj_count = get_object_count();
 
@@ -294,6 +299,9 @@ static void test_reimport_close_race(void)
 	obj_count = get_object_count() - obj_count;
 
 	printf("leaked %i objects\n", obj_count);
+
+	close(fake);
+
 	igt_assert(obj_count == 0);
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 7 lines · Mika Kuoppala

We need to add one drm_open_any() before getting the object counts as first call to drm_open_any() allocates file descriptors for exit handlers and thus is not symmetrical

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77867
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77875

Ah, makes sense. Reviewed-by: Daniel Vetter <[email protected]>

When you push this please add a citation of the commit which introduced this regression like we do it for kernel patches.

Thanks, Daniel

Quoted 64 lines
---
 tests/gem_flink_race.c    |    8 ++++++++
 tests/prime_self_import.c |    8 ++++++++
 2 files changed, 16 insertions(+)
tests/gem_flink_race.c +8 -0
index 3353b83..f129cb3 100644
@@ -163,6 +163,11 @@ static void test_flink_close(void)
 	int r, i, num_threads;
 	int obj_count;
 	void *status;
+	int fake;
+
+	/* Allocate exit handler fds in here so that we dont screw
+	 * up the counts */
+	fake = drm_open_any();
 
 	obj_count = get_object_count();
 
@@ -193,6 +198,9 @@ static void test_flink_close(void)
 	obj_count = get_object_count() - obj_count;
 
 	printf("leaked %i objects\n", obj_count);
+
+	close(fake);
+
 	igt_assert(obj_count == 0);
 }
 
tests/prime_self_import.c +8 -0
index efdd24f..41c203f 100644
@@ -258,6 +258,11 @@ static void test_reimport_close_race(void)
 	int obj_count;
 	void *status;
 	uint32_t handle;
+	int fake;
+
+	/* Allocate exit handler fds in here so that we dont screw
+	 * up the counts */
+	fake = drm_open_any();
 
 	obj_count = get_object_count();
 
@@ -294,6 +299,9 @@ static void test_reimport_close_race(void)
 	obj_count = get_object_count() - obj_count;
 
 	printf("leaked %i objects\n", obj_count);
+
+	close(fake);
+
 	igt_assert(obj_count == 0);
 }
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch