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.krzyszto...@linux.intel.com>
Cc: Jonathan Cavitt <jonathan.cav...@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

Reply via email to