When a user includes a testsuite in their config while also
disallowing all of its respective testcases via the func,
perf, or crypto fields, the testcases will get filtered out
of the testrun, but the testsuite will remain as an empty
testsuite in the results summary. This patch enforces
filtering out testsuites which have had all of their
testcases filtered out.

Bugzilla ID: 1907
Fixes: ba648fb1a66a ("dts: isolate test specification to config")

Signed-off-by: Patrick Robb <[email protected]>
---
 dts/framework/config/test_run.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/dts/framework/config/test_run.py b/dts/framework/config/test_run.py
index 39f2c7cdf6..76e24d1785 100644
--- a/dts/framework/config/test_run.py
+++ b/dts/framework/config/test_run.py
@@ -515,17 +515,18 @@ def filter_tests(
         else:
             test_suites += self.test_suites
 
-        return (
-            (
-                t.test_suite_spec.class_obj,
-                tests_config[t.test_suite_name],
-                deque(
-                    tt
-                    for tt in t.test_cases
-                    if (tt.test_type is TestCaseType.FUNCTIONAL and self.func)
-                    or (tt.test_type is TestCaseType.PERFORMANCE and self.perf)
-                    or (tt.test_type is TestCaseType.CRYPTO and self.crypto)
-                ),
+        filtered_tests = []
+        for t in test_suites:
+            test_cases = deque(
+                tt
+                for tt in t.test_cases
+                if (tt.test_type is TestCaseType.FUNCTIONAL and self.func)
+                or (tt.test_type is TestCaseType.PERFORMANCE and self.perf)
+                or (tt.test_type is TestCaseType.CRYPTO and self.crypto)
             )
-            for t in test_suites
-        )
+            # Only include test suites that have at least one test case after 
filtering
+            if test_cases:
+                filtered_tests.append(
+                    (t.test_suite_spec.class_obj, 
tests_config[t.test_suite_name], test_cases)
+                )
+        return filtered_tests
-- 
2.49.0

Reply via email to