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>,
	Jonathan Cavitt <jonathan.cavitt@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t v3 5/5] lib/kunit: Minimize code duplication
Date: Mon, 18 Mar 2024 11:13:31 +0100	[thread overview]
Message-ID: <20240318103534.701693-12-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20240318103534.701693-7-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.

v3: Rebased on top of changes to struct igt_ktap_results pointer handling.
v2: Rebased on invalid test suite name workaround.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 lib/igt_kmod.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index c495d11b16..8979a5928b 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -1262,21 +1262,14 @@ 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);
-
 	igt_skip_on(sigaction(SIGALRM, &sigalrm, saved));
 	alarm(10);
 
-	do
-		err = kunit_kmsg_result_get(tests, NULL, tst->kmsg, *ktap);
-	while (err == -EINPROGRESS);
+	err = kunit_get_results(tests, tst->kmsg, ktap);
 
 	alarm(0);
 	igt_debug_on(sigaction(SIGALRM, saved, NULL));
 
-	igt_ktap_free(ktap);
-
 	igt_skip_on_f(err,
 		      "KTAP parser failed while getting a list of test cases\n");
 
-- 
2.43.0


  parent reply	other threads:[~2024-03-18 10:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 10:13 [PATCH i-g-t v3 0/5] lib/kunit: Execute test cases synchronously Janusz Krzysztofik
2024-03-18 10:13 ` [PATCH i-g-t v3 1/5] lib/kunit: Store igt_ktap_results pointer in a central location Janusz Krzysztofik
2024-03-19 18:25   ` Kamil Konieczny
2024-03-18 10:13 ` [PATCH i-g-t v3 2/5] lib/kunit: Let igt_ktap_free() take care of pointer reset Janusz Krzysztofik
2024-03-19 18:30   ` Kamil Konieczny
2024-03-18 10:13 ` [PATCH i-g-t v3 3/5] lib/kunit: Time out promptly on missing KTAP report Janusz Krzysztofik
2024-03-19 18:33   ` Kamil Konieczny
2024-03-18 10:13 ` [PATCH i-g-t v3 4/5] lib/kunit: Execute test cases synchronously Janusz Krzysztofik
2024-03-25 17:04   ` Kamil Konieczny
2024-03-18 10:13 ` Janusz Krzysztofik [this message]
2024-03-25 17:12   ` [PATCH i-g-t v3 5/5] lib/kunit: Minimize code duplication Kamil Konieczny
2024-03-18 17:21 ` ✗ CI.Patch_applied: failure for lib/kunit: Execute test cases synchronously (rev3) Patchwork
2024-03-18 17:59 ` ✓ CI.xeBAT: success for lib/kunit: Execute test cases synchronously (rev6) Patchwork
2024-03-18 18:10 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-18 23:28 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-19 18:39 ` [PATCH i-g-t v3 0/5] lib/kunit: Execute test cases synchronously Cavitt, Jonathan

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=20240318103534.701693-12-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=jonathan.cavitt@intel.com \
    --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.