diff options
| author | 2025-11-16 10:10:29 +0200 | |
|---|---|---|
| committer | 2025-11-17 19:32:12 -0800 | |
| commit | bed22c7b90af732978715a1789bca1c3cfa245a6 (patch) | |
| tree | b1444d7e72ede41b6f886d7e5452d1a2802e3e55 /tools/lib/bpf/libbpf_utils.c | |
| parent | s390/ctcm: Fix double-kfree (diff) | |
| download | wireguard-linux-bed22c7b90af732978715a1789bca1c3cfa245a6.tar.xz wireguard-linux-bed22c7b90af732978715a1789bca1c3cfa245a6.zip | |
selftests: net: lib: Do not overwrite error messages
ret_set_ksft_status() calls ksft_status_merge() with the current return
status and the last one. It treats a non-zero return code from
ksft_status_merge() as an indication that the return status was
overwritten by the last one and therefore overwrites the return message
with the last one.
Currently, ksft_status_merge() returns a non-zero return code even if
the current return status and the last one are equal. This results in
return messages being overwritten which is counter-productive since we
are more interested in the first failure message and not the last one.
Fix by changing ksft_status_merge() to only return a non-zero return
code if the current return status was actually changed.
Add a test case which checks that the first error message is not
overwritten.
Before:
# ./lib_sh_test.sh
[...]
TEST: RET tfail2 tfail -> fail [FAIL]
retmsg=tfail expected tfail2
[...]
# echo $?
1
After:
# ./lib_sh_test.sh
[...]
TEST: RET tfail2 tfail -> fail [ OK ]
[...]
# echo $?
0
Fixes: 596c8819cb78 ("selftests: forwarding: Have RET track kselftest framework constants")
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20251116081029.69112-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/lib/bpf/libbpf_utils.c')
0 files changed, 0 insertions, 0 deletions
