[PATCH net-next 2/4] selftests: net: Lower threshold on debug kernels for big_tcp_tunnels.sh

Alice Mikityanska <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
From: Alice Mikityanska <[email protected]>

CONFIG_DEBUG_NET kernels run slower and generate fewer BIG TCP packets,
making the test flaky on upstream CI runners. Lower the default
threshold for those kernels.

Signed-off-by: Alice Mikityanska <[email protected]>
---
 tools/testing/selftests/net/big_tcp_tunnels.sh | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/big_tcp_tunnels.sh b/tools/testing/selftests/net/big_tcp_tunnels.sh
index 9b7d0456bcc1..e27774eae20e 100755
--- a/tools/testing/selftests/net/big_tcp_tunnels.sh
+++ b/tools/testing/selftests/net/big_tcp_tunnels.sh
@@ -17,11 +17,25 @@ CLIENT_IP6="2001:db8::1:2"
 CLIENT_IP4_TUN="192.168.2.2"
 CLIENT_IP6_TUN="2001:db8::2:2"
 
-: "${PACKETS_THRESHOLD:=1000}"
-
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
+is_debug() {
+	local config="/proc/config.gz"
+	[ -f "$config" ] || config="/boot/config-$(uname -r)"
+	[ -f "$config" ] || return 1 # No config found; assume non-debug.
+	gzip -dcfq "$config" | grep -qx 'CONFIG_DEBUG_NET=y' || return 1
+}
+
+if [ -z "$PACKETS_THRESHOLD" ]; then
+	if is_debug; then
+		echo 'Debug kernel detected, lowering the default threshold'
+		PACKETS_THRESHOLD=100
+	else
+		PACKETS_THRESHOLD=1000
+	fi
+fi
+
 setup() {
 	ip netns add "$SERVER_NS"
 	ip netns add "$CLIENT_NS"
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.