netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] selftest: net: Fix error message if empty variable
@ 2025-09-25 13:28 Alessandro Zanni
  2025-09-26 13:00 ` Simon Horman
  2025-09-26 22:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alessandro Zanni @ 2025-09-25 13:28 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 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>
---

Notes:
    v2: edit condition to handle strings

 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..a4550511830a 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 [ "$res" = "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

* Re: [PATCH v2] selftest: net: Fix error message if empty variable
  2025-09-25 13:28 [PATCH v2] selftest: net: Fix error message if empty variable Alessandro Zanni
@ 2025-09-26 13:00 ` Simon Horman
  2025-09-26 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-09-26 13:00 UTC (permalink / raw)
  To: Alessandro Zanni
  Cc: davem, edumazet, kuba, pabeni, shuah, netdev, linux-kselftest,
	linux-kernel

On Thu, Sep 25, 2025 at 03:28:23PM +0200, Alessandro Zanni wrote:
> 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>
> ---
> 
> Notes:
>     v2: edit condition to handle strings

Thanks. This seems more robust to me.

Reviewed-by: Simon Horman <horms@kernel.org>

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

* Re: [PATCH v2] selftest: net: Fix error message if empty variable
  2025-09-25 13:28 [PATCH v2] selftest: net: Fix error message if empty variable Alessandro Zanni
  2025-09-26 13:00 ` Simon Horman
@ 2025-09-26 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-26 22:40 UTC (permalink / raw)
  To: Alessandro Zanni
  Cc: davem, edumazet, kuba, pabeni, horms, shuah, netdev,
	linux-kselftest, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 25 Sep 2025 15:28:23 +0200 you wrote:
> 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
> 
> [...]

Here is the summary with links:
  - [v2] selftest: net: Fix error message if empty variable
    https://git.kernel.org/netdev/net-next/c/81dcfdd21dbd

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 13:28 [PATCH v2] selftest: net: Fix error message if empty variable Alessandro Zanni
2025-09-26 13:00 ` Simon Horman
2025-09-26 22:40 ` patchwork-bot+netdevbpf

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).