All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Daniel <thomas.daniel@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Subject: [PATCH i-g-t] tests/prime_self_import: further fix object counts
Date: Mon, 19 Jan 2015 16:34:51 +0000	[thread overview]
Message-ID: <1421685291-10219-1-git-send-email-thomas.daniel@intel.com> (raw)

A previous commit:

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

introduced a regression for drm object leak checking.  A following commit:

commit 8741c2289f17e9bcb740a01cad4764a71c918eea
Author: Mika Kuoppala <mika.kuoppala@intel.com>
Date:   Wed May 7 16:46:19 2014 +0300

    tests/gem_flink_race,prime_self_import: fix object counts

fixed the regression for some cases but missed the export-vs-gem_close-race
subtest.  Note that test behaviour depends on whether the subtest is run as
part of the whole prime_self_import test (fail), or as a single subtest (pass).
Using execlists on Gen8+ reverses the pass/fail due to lazy context allocation
which is presumably why this has now been noticed.

This commit applies the same fix to the export-vs-gem_close-race subtest.

Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87627
Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
---
 tests/prime_self_import.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index 1eb5a04..ded92cf 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);
 }
 
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

                 reply	other threads:[~2015-01-19 16:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421685291-10219-1-git-send-email-thomas.daniel@intel.com \
    --to=thomas.daniel@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.