All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karthik B S <karthik.b.s@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/i915/kms_big_fb: Move cleanup code to fixture
Date: Tue, 31 May 2022 15:38:15 +0530	[thread overview]
Message-ID: <20220531100815.32431-1-karthik.b.s@intel.com> (raw)

When a subtest fails, it exits from the assert and does not run the
cleanup part of the subtest. To avoid this, move the cleanup code to
igt_fixture outside the subtest.

Signed-off-by: Karthik B S <karthik.b.s@intel.com>
---
 tests/i915/kms_big_fb.c | 38 ++++++++++++++------------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/tests/i915/kms_big_fb.c b/tests/i915/kms_big_fb.c
index 7a850401..9d54f9c9 100644
--- a/tests/i915/kms_big_fb.c
+++ b/tests/i915/kms_big_fb.c
@@ -264,12 +264,6 @@ static void prep_fb(data_t *data)
 	generate_pattern(data, &data->big_fb, 640, 480);
 }
 
-static void cleanup_fb(data_t *data)
-{
-	igt_remove_fb(data->drm_fd, &data->big_fb);
-	data->big_fb.fb_id = 0;
-}
-
 static void set_c8_lut(data_t *data)
 {
 	igt_pipe_t *pipe = &data->display.pipes[data->pipe];
@@ -463,14 +457,6 @@ static bool test_pipe(data_t *data)
 	if (data->format == DRM_FORMAT_C8)
 		unset_lut(data);
 
-	igt_pipe_crc_free(data->pipe_crc);
-
-	igt_output_set_pipe(data->output, PIPE_ANY);
-
-	igt_remove_fb(data->drm_fd, &data->small_fb);
-
-	intel_bb_destroy(data->ibb);
-
 	return ret;
 }
 
@@ -563,14 +549,6 @@ max_hw_stride_async_flip_test(data_t *data)
 	}
 	igt_reset_timeout();
 
-	igt_pipe_crc_free(data->pipe_crc);
-	igt_output_set_pipe(data->output, PIPE_NONE);
-	igt_remove_fb(data->drm_fd, &data->big_fb);
-	igt_remove_fb(data->drm_fd, &data->big_fb_flip[0]);
-	igt_remove_fb(data->drm_fd, &data->big_fb_flip[1]);
-
-	intel_bb_destroy(data->ibb);
-
 	return true;
 }
 
@@ -773,6 +751,18 @@ set_max_hw_stride(data_t *data)
 	}
 }
 
+static void test_cleanup(data_t *data)
+{
+	igt_pipe_crc_free(data->pipe_crc);
+	igt_output_set_pipe(data->output, PIPE_NONE);
+	igt_remove_fb(data->drm_fd, &data->big_fb);
+	igt_remove_fb(data->drm_fd, &data->big_fb_flip[0]);
+	igt_remove_fb(data->drm_fd, &data->big_fb_flip[1]);
+	igt_remove_fb(data->drm_fd, &data->small_fb);
+
+	intel_bb_destroy(data->ibb);
+}
+
 static data_t data = {};
 
 static const struct {
@@ -918,7 +908,7 @@ igt_main
 			}
 
 			igt_fixture
-				cleanup_fb(&data);
+				test_cleanup(&data);
 		}
 	}
 
@@ -975,7 +965,7 @@ igt_main
 				}
 
 				igt_fixture
-					cleanup_fb(&data);
+					test_cleanup(&data);
 			}
 		}
 	}
-- 
2.22.0

             reply	other threads:[~2022-05-31 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 10:08 Karthik B S [this message]
2022-05-31 11:54 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/i915/kms_big_fb: Move cleanup code to fixture Patchwork
2022-05-31 13:44 ` [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=20220531100815.32431-1-karthik.b.s@intel.com \
    --to=karthik.b.s@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 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.