[PATCH net-next] selftests: netconsole: remove log noise due to socat exit

Andre Carvalho posted 1 patch 2 days, 9 hours ago
tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net-next] selftests: netconsole: remove log noise due to socat exit
Posted by Andre Carvalho 2 days, 9 hours ago
This removes some noise that can be distracting while looking at
selftests by redirecting socat stderr to /dev/null.

Before this commit, netcons_basic would output:

Running with target mode: basic (ipv6)
2025/11/29 12:08:03 socat[259] W exiting on signal 15
2025/11/29 12:08:03 socat[271] W exiting on signal 15
basic : ipv6 : Test passed
Running with target mode: basic (ipv4)
2025/11/29 12:08:05 socat[329] W exiting on signal 15
2025/11/29 12:08:05 socat[322] W exiting on signal 15
basic : ipv4 : Test passed
Running with target mode: extended (ipv6)
2025/11/29 12:08:08 socat[386] W exiting on signal 15
2025/11/29 12:08:08 socat[386] W exiting on signal 15
2025/11/29 12:08:08 socat[380] W exiting on signal 15
extended : ipv6 : Test passed
Running with target mode: extended (ipv4)
2025/11/29 12:08:10 socat[440] W exiting on signal 15
2025/11/29 12:08:10 socat[435] W exiting on signal 15
2025/11/29 12:08:10 socat[435] W exiting on signal 15
extended : ipv4 : Test passed

After these changes, output looks like:

Running with target mode: basic (ipv6)
basic : ipv6 : Test passed
Running with target mode: basic (ipv4)
basic : ipv4 : Test passed
Running with target mode: extended (ipv6)
extended : ipv6 : Test passed
Running with target mode: extended (ipv4)
extended : ipv4 : Test passed

Signed-off-by: Andre Carvalho <asantostc@gmail.com>
---
 tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
index 87f89fd92f8c..ae8abff4be40 100644
--- a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
+++ b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
@@ -249,7 +249,7 @@ function listen_port_and_save_to() {
 
 	# Just wait for 2 seconds
 	timeout 2 ip netns exec "${NAMESPACE}" \
-		socat "${SOCAT_MODE}":"${PORT}",fork "${OUTPUT}"
+		socat "${SOCAT_MODE}":"${PORT}",fork "${OUTPUT}" 2> /dev/null
 }
 
 # Only validate that the message arrived properly

---
base-commit: ff736a286116d462a4067ba258fa351bc0b4ed80
change-id: 20251129-netcons-socat-noise-00e7ccf29560

Best regards,
-- 
Andre Carvalho <asantostc@gmail.com>
Re: [PATCH net-next] selftests: netconsole: remove log noise due to socat exit
Posted by Simon Horman 1 day, 5 hours ago
On Sat, Nov 29, 2025 at 12:24:19PM +0000, Andre Carvalho wrote:
> This removes some noise that can be distracting while looking at
> selftests by redirecting socat stderr to /dev/null.
> 
> Before this commit, netcons_basic would output:
> 
> Running with target mode: basic (ipv6)
> 2025/11/29 12:08:03 socat[259] W exiting on signal 15
> 2025/11/29 12:08:03 socat[271] W exiting on signal 15
> basic : ipv6 : Test passed
> Running with target mode: basic (ipv4)
> 2025/11/29 12:08:05 socat[329] W exiting on signal 15
> 2025/11/29 12:08:05 socat[322] W exiting on signal 15
> basic : ipv4 : Test passed
> Running with target mode: extended (ipv6)
> 2025/11/29 12:08:08 socat[386] W exiting on signal 15
> 2025/11/29 12:08:08 socat[386] W exiting on signal 15
> 2025/11/29 12:08:08 socat[380] W exiting on signal 15
> extended : ipv6 : Test passed
> Running with target mode: extended (ipv4)
> 2025/11/29 12:08:10 socat[440] W exiting on signal 15
> 2025/11/29 12:08:10 socat[435] W exiting on signal 15
> 2025/11/29 12:08:10 socat[435] W exiting on signal 15
> extended : ipv4 : Test passed
> 
> After these changes, output looks like:
> 
> Running with target mode: basic (ipv6)
> basic : ipv6 : Test passed
> Running with target mode: basic (ipv4)
> basic : ipv4 : Test passed
> Running with target mode: extended (ipv6)
> extended : ipv6 : Test passed
> Running with target mode: extended (ipv4)
> extended : ipv4 : Test passed
> 
> Signed-off-by: Andre Carvalho <asantostc@gmail.com>
> ---
>  tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> index 87f89fd92f8c..ae8abff4be40 100644
> --- a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> +++ b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> @@ -249,7 +249,7 @@ function listen_port_and_save_to() {
>  
>  	# Just wait for 2 seconds
>  	timeout 2 ip netns exec "${NAMESPACE}" \
> -		socat "${SOCAT_MODE}":"${PORT}",fork "${OUTPUT}"
> +		socat "${SOCAT_MODE}":"${PORT}",fork "${OUTPUT}" 2> /dev/null
>  }
>  
>  # Only validate that the message arrived properly

I'm always concerned that a blanket redirect might hide some corner
cases in the future. But I do agree that this addresses the issue
at hand. And probably I'm over-thinking things here.

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