netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftest: net: Fix error message if empty variable
@ 2025-09-24 23:04 Alessandro Zanni
  2025-09-25 10:49 ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Alessandro Zanni @ 2025-09-24 23:04 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, shuah
  Cc: Alessandro Zanni, netdev, linux-kselftest, linux-kernel

Fix to avoid cases where the `res` shell variable is
empty in script comparisons.

The issue can be reproduced with the command:
make kselftest TARGETS=net

It solves the error:
./tfo_passive.sh: line 98: [: -eq: unary operator expected

Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
 tools/testing/selftests/net/tfo_passive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/tfo_passive.sh b/tools/testing/selftests/net/tfo_passive.sh
index 80bf11fdc046..2655931b2396 100755
--- a/tools/testing/selftests/net/tfo_passive.sh
+++ b/tools/testing/selftests/net/tfo_passive.sh
@@ -95,7 +95,7 @@ wait
 res=$(cat $out_file)
 rm $out_file
 
-if [ $res -eq 0 ]; then
+if [ -n "$res" ] && [ $res -eq 0 ]; then
 	echo "got invalid NAPI ID from passive TFO socket"
 	cleanup_ns
 	exit 1
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-25 12:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24 23:04 [PATCH] selftest: net: Fix error message if empty variable Alessandro Zanni
2025-09-25 10:49 ` Simon Horman
2025-09-25 12:40   ` Alessandro Zanni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).