public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: petri.latvala@intel.com, chris@chris-wilson.co.uk
Subject: [igt-dev] [PATCH i-g-t v2] tests/kms_content_protection: CP cleanup exit handler
Date: Thu, 28 May 2020 19:56:52 +0530	[thread overview]
Message-ID: <20200528142652.31504-1-anshuman.gupta@intel.com> (raw)

Add HDCP content protection cleanup igt exit handler,
earlier it was done through igt_fixture which doesn't
trigger hdcp cleanup on igt abortion due to any signal.
This should avoid any HDCP content protection leak.

v2:
-  wrap up exit handler in igt_fixure only when it is
   running under sub-test block. [Petri]

Cc: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 tests/kms_content_protection.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 3b9cedcb..0f656bcf 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -651,12 +651,30 @@ static void test_content_protection_cleanup(void)
 	}
 }
 
+static void test_content_protection_exit_handler(int sig)
+{
+	/*
+	 * FIXME: igt_can_fail() is sometimes incorrect in exit handlers. Wrap
+	 * cleanup in igt_fixture if igt_core thinks we're not in a subtest.
+	 */
+	if (igt_subtest_name()) {
+		test_content_protection_cleanup();
+		igt_display_fini(&data.display);
+	} else {
+		igt_fixture {
+			test_content_protection_cleanup();
+			igt_display_fini(&data.display);
+		}
+	}
+}
+
 igt_main
 {
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 
 		igt_display_require(&data.display, data.drm_fd);
+		igt_install_exit_handler(test_content_protection_exit_handler);
 	}
 
 	igt_subtest("legacy") {
@@ -723,9 +741,4 @@ igt_main
 		igt_assert_f(ret, "SRM update failed");
 		test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
 	}
-
-	igt_fixture {
-		test_content_protection_cleanup();
-		igt_display_fini(&data.display);
-	}
 }
-- 
2.26.2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2020-05-28 14:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:26 Anshuman Gupta [this message]
2020-05-28 15:08 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_content_protection: CP cleanup exit handler (rev2) Patchwork
2020-05-28 17:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=20200528142652.31504-1-anshuman.gupta@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox