* [PATCH] selftests: tc-testing: fix list_categories() crash on list type
@ 2026-02-28 7:47 mr.navi8680
2026-03-04 2:17 ` Jakub Kicinski
2026-03-04 5:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 6+ messages in thread
From: mr.navi8680 @ 2026-02-28 7:47 UTC (permalink / raw)
To: netdev, linux-kselftest; +Cc: jhs, jiri, shuah, linux-kernel, Naveen Anandhan
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: tc-testing: fix list_categories() crash on list type
2026-02-28 7:47 [PATCH] selftests: tc-testing: fix list_categories() crash on list type mr.navi8680
@ 2026-03-04 2:17 ` Jakub Kicinski
2026-03-04 2:34 ` Naveen A
2026-03-04 5:50 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2026-03-04 2:17 UTC (permalink / raw)
To: mr.navi8680; +Cc: netdev, linux-kselftest, jhs, jiri, shuah, linux-kernel
On Sat, 28 Feb 2026 13:17:35 +0530 mr.navi8680@gmail.com wrote:
> 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.
How did you find this issue?
I can't figure out what's calling this function in the first place.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: tc-testing: fix list_categories() crash on list type
2026-03-04 2:17 ` Jakub Kicinski
@ 2026-03-04 2:34 ` Naveen A
2026-03-04 2:49 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Naveen A @ 2026-03-04 2:34 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, linux-kselftest, jhs, jiri, shuah, linux-kernel
> How did you find this issue? I can't figure out what's calling this
> function in the first place.
I encountered this while running the tc-testing selftests locally.
The script raised the error:
TypeError: unhashable type: 'list'
The traceback pointed to list_categories(), where a set(map(...))
was being created from the 'category' field.
Since 'category' is a list in the test cases, Python attempts to
insert the list itself into the set, which raises the unhashable
type error. After tracing this, I updated the logic to flatten the
category lists and collect unique category names using set.update().
On Wed, 4 Mar 2026 at 07:47, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Sat, 28 Feb 2026 13:17:35 +0530 mr.navi8680@gmail.com wrote:
> > 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.
>
> How did you find this issue?
>
> I can't figure out what's calling this function in the first place.
> --
> pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: tc-testing: fix list_categories() crash on list type
2026-03-04 2:34 ` Naveen A
@ 2026-03-04 2:49 ` Jakub Kicinski
2026-03-04 4:16 ` Naveen A
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2026-03-04 2:49 UTC (permalink / raw)
To: Naveen A; +Cc: netdev, linux-kselftest, jhs, jiri, shuah, linux-kernel
On Wed, 4 Mar 2026 08:04:18 +0530 Naveen A wrote:
> > How did you find this issue? I can't figure out what's calling this
> > function in the first place.
>
> I encountered this while running the tc-testing selftests locally.
Running locally meaning? via tdc.py ? Or some other way ?
$ git grep list_categories
tools/testing/selftests/tc-testing/tdc_helper.py:def list_categories(testlist):
I guess I don't understand what the purpose if tdc_helper.py is
but the function you're polishing appears not to be called today..
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: tc-testing: fix list_categories() crash on list type
2026-03-04 2:49 ` Jakub Kicinski
@ 2026-03-04 4:16 ` Naveen A
0 siblings, 0 replies; 6+ messages in thread
From: Naveen A @ 2026-03-04 4:16 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, linux-kselftest, jhs, jiri, shuah, linux-kernel
You're right — after checking with git grep, it looks like
list_categories() is not currently called anywhere in the
tc-testing framework.
I originally noticed the issue while manually testing the helper
function in a small Python snippet, which triggered the error:
TypeError: unhashable type: 'list'
since the test definitions use a list for category, e.g.:
"category": ["filter", "fw"]
So the patch was intended to make the helper handle that format
correctly. But since the function appears unused today.
Thanks for pointing that out.
On Wed, 4 Mar 2026 at 08:19, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed, 4 Mar 2026 08:04:18 +0530 Naveen A wrote:
> > > How did you find this issue? I can't figure out what's calling this
> > > function in the first place.
> >
> > I encountered this while running the tc-testing selftests locally.
>
> Running locally meaning? via tdc.py ? Or some other way ?
>
> $ git grep list_categories
> tools/testing/selftests/tc-testing/tdc_helper.py:def list_categories(testlist):
>
> I guess I don't understand what the purpose if tdc_helper.py is
> but the function you're polishing appears not to be called today..
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: tc-testing: fix list_categories() crash on list type
2026-02-28 7:47 [PATCH] selftests: tc-testing: fix list_categories() crash on list type mr.navi8680
2026-03-04 2:17 ` Jakub Kicinski
@ 2026-03-04 5:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-04 5:50 UTC (permalink / raw)
To: Naveen A; +Cc: netdev, linux-kselftest, jhs, jiri, shuah, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Sat, 28 Feb 2026 13:17:35 +0530 you wrote:
> 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:
>
> [...]
Here is the summary with links:
- selftests: tc-testing: fix list_categories() crash on list type
https://git.kernel.org/netdev/net/c/fbdfa8da05b6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-04 5:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28 7:47 [PATCH] selftests: tc-testing: fix list_categories() crash on list type mr.navi8680
2026-03-04 2:17 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox