All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t v2 2/2] lib/kunit: Minimize code duplication
Date: Tue, 27 Feb 2024 16:10:42 +0100	[thread overview]
Message-ID: <20240227151128.16802-6-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20240227151128.16802-4-janusz.krzysztofik@linux.intel.com>

A new helper has been introduced recently, used for fetching KTAP results
of a single test case.  Since that helper is called for that purpose
only after the test module is loaded with all other test cases filtered
out, its actual implementation is as simple as collecting all results from
a single KTAP report, no matter how many test suites and test cases it
covers.  Then, it's a good candidate for reuse in other scenarios when a
single KTAP report is handled, e.g., when we collect a list of test cases
from a single test suite or test module.  Go for it.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 lib/igt_kmod.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index e9e00ac5b2..86cf50d5b7 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -1177,9 +1177,8 @@ static bool kunit_get_tests(struct igt_list_head *tests,
 			    const char *opts)
 {
 	struct igt_ktap_result *r, *rn;
-	struct igt_ktap_results *ktap;
 	unsigned long taints;
-	int flags, err;
+	int flags;
 
 	igt_skip_on_f(tst->kmsg < 0, "Could not open /dev/kmsg\n");
 
@@ -1203,17 +1202,7 @@ static bool kunit_get_tests(struct igt_list_head *tests,
 	igt_skip_on(modprobe(tst->kmod, opts));
 	igt_skip_on(igt_kernel_tainted(&taints));
 
-	ktap = igt_ktap_alloc(tests);
-	igt_require(ktap);
-
-	do
-		err = kunit_kmsg_result_get(tests, NULL, tst->kmsg, ktap);
-	while (err == -EINPROGRESS);
-
-	igt_ktap_free(ktap);
-
-	igt_skip_on_f(err,
-		      "KTAP parser failed while getting a list of test cases\n");
+	igt_skip_on(kunit_get_results(tests, tst->kmsg));
 
 	igt_list_for_each_entry_safe(r, rn, tests, link)
 		igt_require_f(r->code == IGT_EXIT_SKIP,
-- 
2.43.0


  parent reply	other threads:[~2024-02-27 15:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 15:10 [PATCH i-g-t v2 0/2] lib/kunit: Execute test cases synchronously Janusz Krzysztofik
2024-02-27 15:10 ` [PATCH i-g-t v2 1/2] " Janusz Krzysztofik
2024-03-07 17:54   ` Kamil Konieczny
2024-03-14 10:29   ` Kamil Konieczny
2024-03-14 11:48     ` Janusz Krzysztofik
2024-02-27 15:10 ` Janusz Krzysztofik [this message]
2024-03-07 17:48   ` [PATCH i-g-t v2 2/2] lib/kunit: Minimize code duplication Kamil Konieczny
2024-02-27 15:19 ` ✗ CI.Patch_applied: failure for lib/kunit: Execute test cases synchronously (rev2) Patchwork
2024-02-27 15:38 ` ✓ CI.xeBAT: success " Patchwork
2024-02-27 15:48 ` ✓ Fi.CI.BAT: " Patchwork
2024-02-28  2:33 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-07 10:25 ` ✓ CI.xeBAT: success for lib/kunit: Execute test cases synchronously (rev3) Patchwork
2024-03-07 10:32 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-07 18:21 ` ✗ Fi.CI.BAT: failure for lib/kunit: Execute test cases synchronously (rev4) Patchwork
2024-03-07 18:24 ` ✓ CI.xeBAT: success " Patchwork
2024-03-07 20:58 ` [PATCH i-g-t v2 0/2] lib/kunit: Execute test cases synchronously Cavitt, Jonathan
2024-03-13 11:59 ` ✓ CI.xeBAT: success for lib/kunit: Execute test cases synchronously (rev5) Patchwork
2024-03-13 12:16 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-13 16:33 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-13 16:52   ` Janusz Krzysztofik
2024-03-14 19:24 ` 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=20240227151128.16802-6-janusz.krzysztofik@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=mchehab@kernel.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.