]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools: ynl: cli: order set->list conversion in JSON output
authorJakub Kicinski <kuba@kernel.org>
Sat, 7 Mar 2026 17:59:16 +0000 (09:59 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 Mar 2026 00:54:02 +0000 (17:54 -0700)
NIPA tries to make sure that HW tests don't modify system state.
It dumps some well known configs before and after the test and
compares the outputs.

Make sure that YNL json output is stable. Converting sets to lists
with a naive list(o) results in a random order.

Link: https://patch.msgid.link/20260307175916.1652518-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/cli.py

index 94a5ba348b69b543052368e337403d7b18950239..b452d4fb943496f6ffdf7c00a207af2b5f712c0d 100755 (executable)
@@ -78,7 +78,7 @@ class YnlEncoder(json.JSONEncoder):
         if isinstance(o, bytes):
             return bytes.hex(o)
         if isinstance(o, set):
-            return list(o)
+            return sorted(o)
         return json.JSONEncoder.default(self, o)