public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t] tests/kms_flip: Don't use igt_fixture in an exit handler
Date: Tue, 19 May 2020 12:48:21 +0300	[thread overview]
Message-ID: <20200519094821.29150-1-petri.latvala@intel.com> (raw)

kms_flip's exit handler was wrapped in an igt_fixture some 7 years ago
because "it can fail". That's not a problem anymore, as igt_fail()
will explicitly handle failing in an exit handler.

Rather, using igt_fixture in an exit handler is harmful because on a
subtest failure, we don't always keep track of the currently running
context (whether we're inside a subtest anymore) and we forcefully
assert correct nesting of IGT magic control blocks now.

We already know the state is cleanable because we only install the
handler on a successful init. Unconditional cleanup in an exit handler
is the correct thing to do in general.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 tests/kms_flip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 46bfc585..4b6affe1 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1536,10 +1536,8 @@ static void get_timestamp_format(void)
 
 static void kms_flip_exit_handler(int sig)
 {
-	igt_fixture {
-		if (last_connector)
-			kmstest_set_connector_dpms(drm_fd, last_connector, DRM_MODE_DPMS_ON);
-	}
+	if (last_connector)
+		kmstest_set_connector_dpms(drm_fd, last_connector, DRM_MODE_DPMS_ON);
 }
 
 static void test_nonblocking_read(int in)
-- 
2.20.1

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

             reply	other threads:[~2020-05-19  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  9:48 Petri Latvala [this message]
2020-05-19 10:56 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip: Don't use igt_fixture in an exit handler Patchwork
2020-05-19 11:10 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2020-05-19 15:06 ` [igt-dev] ✓ Fi.CI.IGT: success for " 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=20200519094821.29150-1-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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