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.

The regression, assymmetric behaviour, was introduced in:

commit 2f2c491cf3167befe7c79e4b17afb4f6284dfc84
Author: Mika Kuoppala <mika.kuoppala@intel.com>
Date:   Fri Mar 28 10:52:46 2014 +0200

    lib/drmtest: don't dup quiescent fd

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77867
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77875
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
This commit is contained in:
Mika Kuoppala 2014-05-07 16:46:19 +03:00
parent 7935bbd9ba
commit 8741c2289f
2 changed files with 16 additions and 0 deletions

View File

@ -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);
}

View File

@ -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);
}