public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: mr.navi8680@gmail.com
To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: jhs@mojatatu.com, jiri@resnulli.us, shuah@kernel.org,
	linux-kernel@vger.kernel.org,
	Naveen Anandhan <mr.navi8680@gmail.com>
Subject: [PATCH] selftests: tc-testing: fix list_categories() crash on list type
Date: Sat, 28 Feb 2026 13:17:35 +0530	[thread overview]
Message-ID: <20260228074735.10438-1-mr.navi8680@gmail.com> (raw)

From: Naveen Anandhan <mr.navi8680@gmail.com>

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>
---
 tools/testing/selftests/tc-testing/tdc_helper.py | 10 +++++++---
 1 file 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 e06f03c0fb5d..adb52fe3acc1 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("")
 
 
-- 
2.43.0


             reply	other threads:[~2026-02-28  7:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  7:47 mr.navi8680 [this message]
2026-03-04  2:17 ` [PATCH] selftests: tc-testing: fix list_categories() crash on list type Jakub Kicinski
2026-03-04  2:34   ` Naveen A
2026-03-04  2:49     ` Jakub Kicinski
2026-03-04  4:16       ` Naveen A
2026-03-04  5:50 ` patchwork-bot+netdevbpf

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=20260228074735.10438-1-mr.navi8680@gmail.com \
    --to=mr.navi8680@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox