selftests: net: py: check process exit code in bkg() and background cmd()
authorJakub Kicinski <kuba@kernel.org>
Thu, 2 May 2024 02:53:25 +0000 (19:53 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 3 May 2024 01:20:49 +0000 (18:20 -0700)
commite1bb5e65de8355ee76f51c6bfee2328ac5b2be15
tree77fb0371c16f4973530137b3b5874c8bfb59650c
parent1c8f43f477d92fda15bccd703b808cd46899cd3c
selftests: net: py: check process exit code in bkg() and background cmd()

We're a bit too loose with error checking for background
processes. cmd() completely ignores the fail argument
passed to the constructor if background is True.
Default to checking for errors if process is not terminated
explicitly. Caller can override with True / False.

For bkg() the processing step is called magically by __exit__
so record the value passed in the constructor.

Reported-by: Willem de Bruijn <willemb@google.com>
Tested-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240502025325.1924923-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/lib/py/utils.py