penguin/tinyproxy

An L4 proxy designed to act as a tiny transparent shim

commit 28609e083e6a98e89f61122b49a2a57759eee55b

author斟酌 鵬兄 <tgckpg@gmail.com>
date2026-05-30T15:49:15Z
subjectLower bsd test requirements
commit 28609e083e6a98e89f61122b49a2a57759eee55b
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2026-05-30T15:49:15Z

    Lower bsd test requirements
---
 .github/workflows/cmake-multi-platform.yml |  8 +++++++-
 tests/test_tcp_basic.py                    | 20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml
index b966f8f..7c7c693 100644
--- a/.github/workflows/cmake-multi-platform.yml
+++ b/.github/workflows/cmake-multi-platform.yml
@@ -156,7 +156,13 @@ jobs:
             set -eu
 
             gmake clean all EXTRA_CFLAGS="-Og -g3 -Wpedantic"
-            gmake test
+
+            # BSD is running in a VM. Lower the requirements.
+            #   GitHub Actions runner VM
+            #   -> FreeBSD VM/emulator
+            gmake test \
+              CONCURRENCY=100 TOTAL=100 FD_LIMIT=2560 \
+              LARGE_ROUNDTRIP_SIZE=65536 SEQUENTIAL_CONNECTIONS=100
 
             gmake clean all
 
diff --git a/tests/test_tcp_basic.py b/tests/test_tcp_basic.py
index c928391..4b61719 100644
--- a/tests/test_tcp_basic.py
+++ b/tests/test_tcp_basic.py
@@ -1,3 +1,5 @@
+import os
+
 from .support import proxy_roundtrip
 
 
@@ -9,13 +11,23 @@ async def test_small_roundtrip() -> None:
 
 
 async def test_large_roundtrip() -> None:
-	payload = b"0123456789abcdef" * 131072  # 2 MiB
-	got = await proxy_roundtrip(payload, timeout=30.0)
+	payload_size = int(os.environ.get("LARGE_ROUNDTRIP_SIZE", str(256 * 1024)))
+	timeout = float(os.environ.get("LARGE_ROUNDTRIP_TIMEOUT", "60.0"))
+
+	chunk = b"0123456789abcdef"
+	payload = (chunk * ((payload_size // len(chunk)) + 1))[:payload_size]
+
+	got = await proxy_roundtrip(payload, timeout=timeout)
+
+	assert got == payload, (
+		f"large roundtrip mismatch: expected {len(payload)} bytes, "
+		f"got {len(got)} bytes"
+	)
 
-	assert got == payload, f"large roundtrip mismatch: got {len(got)} bytes"
 
+async def test_many_sequential_connections() -> None:
+	count = int(os.environ.get("SEQUENTIAL_CONNECTIONS", "1000"))
 
-async def test_many_sequential_connections(count: int = 1000) -> None:
 	for i in range(count):
 		payload = f"message-{i}\n".encode()
 		got = await proxy_roundtrip(payload)