]> www.infradead.org Git - users/hch/misc.git/commitdiff
selftest: net: Fix error message if empty variable
authorAlessandro Zanni <alessandro.zanni87@gmail.com>
Thu, 25 Sep 2025 13:28:23 +0000 (15:28 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 26 Sep 2025 22:23:33 +0000 (15:23 -0700)
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>
tools/testing/selftests/net/tfo_passive.sh

index 80bf11fdc046232bfac8d9a92ddaa97967b35266..a4550511830a9b1b464dacca959a4026f0775177 100755 (executable)
@@ -95,7 +95,7 @@ wait
 res=$(cat $out_file)
 rm $out_file
 
-if [ $res -eq 0 ]; then
+if [ "$res" = "0" ]; then
        echo "got invalid NAPI ID from passive TFO socket"
        cleanup_ns
        exit 1