Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftest: net: Fix error message if empty variable

Fix to avoid cases where the `res` shell variable is
empty in script comparisons.
The comparison has been modified into string comparison to
handle other possible values the variable could assume.

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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250925132832.9828-1-alessandro.zanni87@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alessandro Zanni and committed by
Jakub Kicinski
81dcfdd2 793adf57

+1 -1
+1 -1
tools/testing/selftests/net/tfo_passive.sh
··· 95 95 res=$(cat $out_file) 96 96 rm $out_file 97 97 98 - if [ $res -eq 0 ]; then 98 + if [ "$res" = "0" ]; then 99 99 echo "got invalid NAPI ID from passive TFO socket" 100 100 cleanup_ns 101 101 exit 1