summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/prime_self_import.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index 1eb5a04a..ded92cfc 100644
--- a/tests/prime_self_import.c
+++ b/tests/prime_self_import.c
@@ -342,15 +342,20 @@ static void test_export_close_race(void)
int fd;
int obj_count;
void *status;
+ int fake;
num_threads = sysconf(_SC_NPROCESSORS_ONLN);
threads = calloc(num_threads, sizeof(pthread_t));
- fd = drm_open_any();
+ /* Allocate exit handler fds in here so that we dont screw
+ * up the counts */
+ fake = drm_open_any();
obj_count = get_object_count();
+ fd = drm_open_any();
+
for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL,
thread_fn_export_vs_close,
@@ -372,6 +377,9 @@ static void test_export_close_race(void)
obj_count = get_object_count() - obj_count;
igt_info("leaked %i objects\n", obj_count);
+
+ close(fake);
+
igt_assert_eq(obj_count, 0);
}