[PATCH] selftests: tc-testing: preserve list order when removing duplicates

Subsystems: kernel selftest framework, the rest

STALE202d

2 messages, 2 authors, 2026-02-24 · open the first message on its own page

[PATCH] selftests: tc-testing: preserve list order when removing duplicates

From: <hidden>
Date: 2026-02-22 09:56:41

From: Naveen Anandhan <redacted>

Using set() removes duplicates but breaks ordering.
Test output should be deterministic, so replace with dict.fromkeys().

Signed-off-by: Naveen Anandhan <redacted>
---
 tools/testing/selftests/tc-testing/tdc_helper.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/tc-testing/tdc_helper.py b/tools/testing/selftests/tc-testing/tdc_helper.py
index 0440d252c4c5..e06f03c0fb5d 100644
--- a/tools/testing/selftests/tc-testing/tdc_helper.py
+++ b/tools/testing/selftests/tc-testing/tdc_helper.py
@@ -16,9 +16,9 @@ def get_categorized_testlist(alltests, ucat):
 
 
 def get_unique_item(lst):
-    """ For a list, return a list of the unique items in the list. """
+    """Return unique items while preserving original order."""
     if len(lst) > 1:
-        return list(set(lst))
+        return list(dict.fromkeys(lst))
     else:
         return lst
 
-- 
2.43.0

Re: [PATCH] selftests: tc-testing: preserve list order when removing duplicates

From: patchwork-bot+netdevbpf@kernel.org
Date: 2026-02-24 12:19:35

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni [off-list ref]:

On Sun, 22 Feb 2026 15:25:36 +0530 you wrote:
From: Naveen Anandhan <redacted>

Using set() removes duplicates but breaks ordering.
Test output should be deterministic, so replace with dict.fromkeys().

Signed-off-by: Naveen Anandhan <redacted>

[...]
Here is the summary with links:
  - selftests: tc-testing: preserve list order when removing duplicates
    https://git.kernel.org/netdev/net-next/c/8ac768bb198c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help