summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Anandhan <mr.navi8680@gmail.com>2026-02-28 10:47:35 +0300
committerDavid S. Miller <davem@davemloft.net>2026-03-04 08:42:57 +0300
commitfbdfa8da05b6ae44114fc4f9b3e83e1736fd411c (patch)
tree7ce1bfa267b80c182f0b713ca4f8de8aa4595019
parent46d0d6f50dab706637f4c18a470aac20a21900d3 (diff)
downloadlinux-fbdfa8da05b6ae44114fc4f9b3e83e1736fd411c.tar.xz
selftests: tc-testing: fix list_categories() crash on list type
list_categories() builds a set directly from the 'category' field of each test case. Since 'category' is a list, set(map(...)) attempts to insert lists into a set, which raises: TypeError: unhashable type: 'list' Flatten category lists and collect unique category names using set.update() instead. Signed-off-by: Naveen Anandhan <mr.navi8680@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/testing/selftests/tc-testing/tdc_helper.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/testing/selftests/tc-testing/tdc_helper.py b/tools/testing/selftests/tc-testing/tdc_helper.py
index 0440d252c4c5..bc447ca57333 100644
--- a/tools/testing/selftests/tc-testing/tdc_helper.py
+++ b/tools/testing/selftests/tc-testing/tdc_helper.py
@@ -38,10 +38,14 @@ def list_test_cases(testlist):
def list_categories(testlist):
- """ Show all categories that are present in a test case file. """
- categories = set(map(lambda x: x['category'], testlist))
+ """Show all unique categories present in the test cases."""
+ categories = set()
+ for t in testlist:
+ if 'category' in t:
+ categories.update(t['category'])
+
print("Available categories:")
- print(", ".join(str(s) for s in categories))
+ print(", ".join(sorted(categories)))
print("")