Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v2 6/9] drm/xe/kunit: Use xe kunit helpers in RTP test
Date: Mon, 11 Dec 2023 11:17:16 +0100	[thread overview]
Message-ID: <20231211101719.1659-7-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20231211101719.1659-1-michal.wajdeczko@intel.com>

Replace local solution with common helper code.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/tests/xe_rtp_test.c | 36 ++------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
index 4a6972897675..1c4693ec94b8 100644
--- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
@@ -15,6 +15,7 @@
 #include "regs/xe_reg_defs.h"
 #include "xe_device.h"
 #include "xe_device_types.h"
+#include "xe_kunit_helpers.h"
 #include "xe_pci_test.h"
 #include "xe_reg_sr.h"
 #include "xe_rtp.h"
@@ -267,38 +268,6 @@ static void rtp_desc(const struct rtp_test_case *t, char *desc)
 
 KUNIT_ARRAY_PARAM(rtp, cases, rtp_desc);
 
-static int xe_rtp_test_init(struct kunit *test)
-{
-	struct xe_device *xe;
-	struct device *dev;
-	int ret;
-
-	dev = drm_kunit_helper_alloc_device(test);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
-
-	xe = drm_kunit_helper_alloc_drm_device(test, dev,
-					       struct xe_device,
-					       drm, DRIVER_GEM);
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe);
-
-	/* Initialize an empty device */
-	test->priv = NULL;
-	ret = xe_pci_fake_device_init(xe);
-	KUNIT_ASSERT_EQ(test, ret, 0);
-
-	xe->drm.dev = dev;
-	test->priv = xe;
-
-	return 0;
-}
-
-static void xe_rtp_test_exit(struct kunit *test)
-{
-	struct xe_device *xe = test->priv;
-
-	drm_kunit_helper_free_device(test, xe->drm.dev);
-}
-
 static struct kunit_case xe_rtp_tests[] = {
 	KUNIT_CASE_PARAM(xe_rtp_process_tests, rtp_gen_params),
 	{}
@@ -306,8 +275,7 @@ static struct kunit_case xe_rtp_tests[] = {
 
 static struct kunit_suite xe_rtp_test_suite = {
 	.name = "xe_rtp",
-	.init = xe_rtp_test_init,
-	.exit = xe_rtp_test_exit,
+	.init = xe_kunit_helper_xe_device_test_init,
 	.test_cases = xe_rtp_tests,
 };
 
-- 
2.25.1


  parent reply	other threads:[~2023-12-11 10:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 10:17 [PATCH v2 0/9] Introduce GuC Doorbells Manager Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 1/9] drm/xe: Add GT oriented drm_printers Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 2/9] drm/xe: Use GT oriented functions to report TLB timeout Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 3/9] drm/xe: Introduce GuC Doorbells Manager Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 4/9] drm/xe/kunit: Set SR-IOV mode of the fake device Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 5/9] drm/xe/kunit: Define helper functions to allocate mock device Michal Wajdeczko
2023-12-11 10:17 ` Michal Wajdeczko [this message]
2023-12-11 10:17 ` [PATCH v2 7/9] drm/xe/kunit: Use xe kunit helpers in WA test Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 8/9] drm/xe/kunit: Enable CONFIG_LOCKDEP in tests Michal Wajdeczko
2023-12-11 10:17 ` [PATCH v2 9/9] drm/xe/kunit: Add GuC Doorbells Manager tests Michal Wajdeczko
2023-12-11 10:20 ` ✓ CI.Patch_applied: success for Introduce GuC Doorbells Manager (rev2) Patchwork
2023-12-11 10:20 ` ✗ CI.checkpatch: warning " Patchwork
2023-12-11 10:21 ` ✓ CI.KUnit: success " Patchwork
2023-12-11 10:29 ` ✓ CI.Build: " Patchwork
2023-12-11 10:29 ` ✓ CI.Hooks: " Patchwork
2023-12-11 10:30 ` ✓ CI.checksparse: " Patchwork
2023-12-11 11:07 ` ✗ CI.BAT: failure " Patchwork
2023-12-11 18:49   ` Michal Wajdeczko

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=20231211101719.1659-7-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@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