Skip to contentSkip to conversation

selftests: netconsole: print diagnostic on busywait timeout in netcons_basic

PATCH Applied Breno Leitao 2 participants 2 messages Mar 2 – Mar 4

Subsystems (4)
lore
Share & tools
lore

Breno Leitao

author maintainer
#0 lore raw

PATCH 1/1 selftests: netconsole: print diagnostic on busywait timeout in netcons_basic

The script uses set -euo pipefail, so when busywait times out waiting for the netconsole message to arrive, it returns 1 and the script exits immediately without printing any error message. As reported by Jakub, this makes failures hard to diagnose since the test reports exit=1 with no explanation.

Handle the busywait failure explicitly so that a FAIL message is printed before exiting. This is how it looks like now:

Running with target mode: basic (ipv6)
[ 167.452561] netconsole selftest: netcons_QdMay
FAIL: Timed out waiting (20000 ms) for netconsole message in /tmp/netcons_QdMay

The remaining silent failures under set -e can only happen during the setup phase (netdevsim creation, interface configuration, configfs writes). So, it is not expected to have any silent failure once the test starts.

Note that this issue might be less frequent now, since commit a68a9bd086c28 ("selftests: netconsole: Increase port listening timeout") increased the timeout that _might_ have been the root cause of these random failures in NIPA.

---
 tools/testing/selftests/drivers/net/netconsole/netcons_basic.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/netconsole/netcons_basic.sh +5 -1
index 59cf10013ecd5..7976206523b2c 100755
@@ -58,7 +58,11 @@ do
 		# Send the message
 		echo "${MSG}: ${TARGET}" > /dev/kmsg
 		# Wait until socat saves the file to disk
-		busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}"
+		if ! busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}"
+		then
+			echo "FAIL: Timed out waiting (${BUSYWAIT_TIMEOUT} ms) for netconsole message in ${OUTPUT_FILE}" >&2
+			exit "${ksft_fail}"
+		fi
 
 		# Make sure the message was received in the dst part
 		# and exit

---
base-commit: 01857fc712f6469cab9cc578120cdc80f1c2a634
change-id: 20260302-netconsole_test_verbose-367afde9a7d4

Best regards,

Signature · 1 line
Breno Leitao <[email protected]>
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 02 Mar 2026 06:40:39 -0800 you wrote:

The script uses set -euo pipefail, so when busywait times out waiting for the netconsole message to arrive, it returns 1 and the script exits immediately without printing any error message. As reported by Jakub, this makes failures hard to diagnose since the test reports exit=1 with no explanation.

Handle the busywait failure explicitly so that a FAIL message is printed before exiting. This is how it looks like now:

[...]

Here is the summary with links:
- [net-next] selftests: netconsole: print diagnostic on busywait timeout in netcons_basic

    https://git.kernel.org/netdev/net-next/c/dfa77c0dd4ab

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html