linux/tools/testing/selftests/net/lib
Gal Pressman a84a1fe0fb selftests: net: fix wrong boolean evaluation in __exit__
The __exit__ method receives ex_type as the exception class when an
exception occurs. The previous code used implicit boolean evaluation:

    terminate = self.terminate or (self._exit_wait and ex_type)
                                                   ^^^^^^^^^^^

In Python, the and operator can be used with non-boolean values, but it
does not always return a boolean result.

This is probably not what we want, because 'self._exit_wait and ex_type'
could return the actual ex_type value (the exception class) rather than
a boolean True when an exception occurs.

Use explicit `ex_type is not None` check to properly evaluate whether
an exception occurred, returning a boolean result.

Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20260125105524.773993-1-gal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-01-26 19:32:20 -08:00
..
py selftests: net: fix wrong boolean evaluation in __exit__ 2026-01-26 19:32:20 -08:00
sh selftests: defer: Introduce DEFER_PAUSE_ON_FAIL 2025-09-11 19:02:51 -07:00
.gitignore selftests: net: move xdp_helper to net/lib 2025-04-28 15:49:10 -07:00
Makefile selftests: net: remove old setup_* scripts 2025-11-20 18:19:31 -08:00
csum.c selftests: net: csum: Fix printk format in recv_get_packet_csum_status() 2026-01-19 10:09:47 -08:00
ksft.h selftests: net: Fix build warnings 2025-12-10 01:11:12 -08:00
ksft_setup_loopback.sh selftests: net: remove old setup_* scripts 2025-11-20 18:19:31 -08:00
xdp_dummy.bpf.c selftests: drv-net: add xdp cases for ping.py 2025-03-10 13:31:12 -07:00
xdp_helper.c selftests: net: retry when bind returns EBUSY in xdp_helper 2025-04-28 15:49:10 -07:00
xdp_native.bpf.c selftests: drv-net: xdp: Fix register spill error with clang 20 2025-11-14 17:45:07 -08:00