Skip to contentSkip to conversation

tools: ynl: don't append doc of missing type directly to the type

PATCH Applied Jakub Kicinski 3 participants 3 messages Apr 26, 2024 – Apr 27, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: don't append doc of missing type directly to the type

When using YNL in tests appending the doc string to the type name makes it harder to check that we got the correct error. Put the doc under a separate key.

---
 tools/net/ynl/lib/ynl.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/net/ynl/lib/ynl.py +2 -3
index 35f82a2c2247..35e666928119 100644
@@ -233,10 +233,9 @@ from .nlspec import SpecFamily
                     miss_type = self.extack['miss-type']
                     if miss_type in attr_space.attrs_by_val:
                         spec = attr_space.attrs_by_val[miss_type]
-                        desc = spec['name']
+                        self.extack['miss-type'] = spec['name']
                         if 'doc' in spec:
-                            desc += f" ({spec['doc']})"
-                        self.extack['miss-type'] = desc
+                            self.extack['miss-type-doc'] = spec['doc']
 
     def _decode_policy(self, raw):
         policy = {}
Signature · 1 line
2.44.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jakub Kicinski

When using YNL in tests appending the doc string to the type name makes it harder to check that we got the correct error. Put the doc under a separate key.

Quoted 21 lines
---
 tools/net/ynl/lib/ynl.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/net/ynl/lib/ynl.py +2 -3
index 35f82a2c2247..35e666928119 100644
@@ -233,10 +233,9 @@ from .nlspec import SpecFamily
                     miss_type = self.extack['miss-type']
                     if miss_type in attr_space.attrs_by_val:
                         spec = attr_space.attrs_by_val[miss_type]
-                        desc = spec['name']
+                        self.extack['miss-type'] = spec['name']
                         if 'doc' in spec:
-                            desc += f" ({spec['doc']})"
-                        self.extack['miss-type'] = desc
+                            self.extack['miss-type-doc'] = spec['doc']
 
     def _decode_policy(self, raw):
         policy = {}
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 25 Apr 2024 17:31:11 -0700 you wrote:

When using YNL in tests appending the doc string to the type name makes it harder to check that we got the correct error. Put the doc under a separate key.

---
 tools/net/ynl/lib/ynl.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Here is the summary with links:
- [net-next] tools: ynl: don't append doc of missing type directly to the type

    https://git.kernel.org/netdev/net-next/c/5c4c0edca68a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html