devlink: add support to run selftest
Subsystems (2)
v6 cover devlink: add support to run selftest
Hi,
This patchset adds support in devlink to run selftests. A related patchset for kernel has been merged.
Below are the few examples for the commands implemented in the patchset.
Examples:
$ devlink dev selftests run pci/0000:03:00.0 id flash
pci/0000:03:00.0:
flash:
status passed$ devlink dev selftests show pci/0000:03:00.0
pci/0000:03:00.0
flashchanges from:v5->v6
Remove header file(devlink.h) patch in v5 as its already updated. Resolve conflicts in devlink.c due to rebase with iproute2-next but no change in implementation/functionality.
v4->v5
Addressed the comments by [email protected]. Change in json output for seltests show command.
v3->v4
Updated with the UAPI kernel header and hence related implementation for selftests impacted due to reorganization of enums/attributes.
v2->v3
a) Update the implementation of commands according to the latest patch set of kernel devlink patch.
b) Added bash-completion.
v1->v2
a) Changes required to implement command due to changes in kernel patch (under review).
b) Added commands descriptions in devlink-dev man page.
Thanks,
Vikas
Vikas Gupta (1):
devlink: add support for running selftests
bash-completion/devlink | 30 +++- devlink/devlink.c | 328 ++++++++++++++++++++++++++++++++++++++++ man/man8/devlink-dev.8 | 46 ++++++ 3 files changed, 403 insertions(+), 1 deletion(-)
Signature · 1 line
2.31.1
PATCH v6 1/1 devlink: add support for running selftests
Add commands and helper APIs to run selftests. Include a selftest id for a non volatile memory i.e. flash. Also, update the man page and bash-completion for selftests commands.
Examples:
$ devlink dev selftests run pci/0000:03:00.0 id flash
pci/0000:03:00.0:
flash:
status passed$ devlink dev selftests show pci/0000:03:00.0
pci/0000:03:00.0
flash$ devlink dev selftests show pci/0000:03:00.0 -j
{"selftests":{"pci/0000:03:00.0":["flash"]}}$ devlink dev selftests run pci/0000:03:00.0 id flash -j
{"selftests":{"pci/0000:03:00.0":{"flash":{"status":"passed"}}}}--- bash-completion/devlink | 30 +++- devlink/devlink.c | 328 ++++++++++++++++++++++++++++++++++++++++ man/man8/devlink-dev.8 | 46 ++++++ 3 files changed, 403 insertions(+), 1 deletion(-)
bash-completion/devlink +29 -1
@@ -33,6 +33,11 @@ _devlink_direct_complete() dev) value=$(devlink dev show 2>/dev/null) ;; + selftests_id) + dev=${words[4]} + value=$(devlink -j dev selftests show 2>/dev/null \ + | jq ".selftests[\"$dev\"][]") + ;; param_name) dev=${words[4]} value=$(devlink -j dev param show 2>/dev/null \
@@ -275,6 +280,29 @@ _devlink_dev_flash() esac } +# Completion for devlink dev selftests +_devlink_dev_selftests() +{ + if [[ $cword -gt 5 ]]; then + _devlink_direct_complete "selftests_id" + return + fi + case "$cword" in + 3) + COMPREPLY=( $( compgen -W "show run" -- "$cur" ) ) + return + ;; + 4) + _devlink_direct_complete "dev" + return + ;; + 5) + COMPREPLY=( $( compgen -W "id" -- "$cur" ) ) + return + ;; + esac +} + # Completion for devlink dev _devlink_dev() {
@@ -287,7 +315,7 @@ _devlink_dev() fi return ;; - eswitch|param) + eswitch|param|selftests) _devlink_dev_$command return ;;
devlink/devlink.c +328 -0
400 lines not on this page · raw message
man/man8/devlink-dev.8 +46 -0
64 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH iproute2-next v6 1/1] devlink: add support for running selftests
Quoted 15 lines · Thu, Aug 04, 2022 at 11:18:02AM CEST, [email protected] wrote:
Add commands and helper APIs to run selftests. Include a selftest id for a non volatile memory i.e. flash. Also, update the man page and bash-completion for selftests commands.
Examples:
$ devlink dev selftests run pci/0000:03:00.0 id flash pci/0000:03:00.0: flash: status passed$ devlink dev selftests show pci/0000:03:00.0 pci/0000:03:00.0 flash
Quoted 7 lines
$ devlink dev selftests show pci/0000:03:00.0 -j {"selftests":{"pci/0000:03:00.0":["flash"]}}$ devlink dev selftests run pci/0000:03:00.0 id flash -j {"selftests":{"pci/0000:03:00.0":{"flash":{"status":"passed"}}}}Signed-off-by Vikas Gupta <[email protected]>
Next time, don't send cover letter for a single patch.
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Hello:
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Quoted 8 lines · On Thu, 4 Aug 2022 14:48:01 +0530 you wrote:
Hi,
This patchset adds support in devlink to run selftests. A related patchset for kernel has been merged.Below are the few examples for the commands implemented in the patchset.
[...]
Here is the summary with links:
- [iproute2-next,v6,1/1] devlink: add support for running selftests
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=06cb288d63f5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html