mirror of
https://github.com/3proxy/3proxy.git
synced 2026-10-28 22:05:48 +08:00
looponce() called nothing due when waiting for the sockets failed, returning at once: a caller waiting for a timer turned forever. What is due is called all the same, and on Windows WSAEINTR is no failure, not errno. looptest reports any failure to wait with its error; fibertest starts Winsock, its loop could not be made without, and recurses into half of a fiber's stack rather than most of it, which Windows takes more of. The units case shows what a test which never finished wrote. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.5 KiB
Python
35 lines
1.5 KiB
Python
"""The event loop and fibers on their own: tests/looptest.c and
|
|
tests/fibertest.c, built by CMake next to the 3proxy binary, each run with
|
|
a few seeds. Skipped where they were not built (the Makefiles do not build
|
|
them)."""
|
|
|
|
import os
|
|
import subprocess
|
|
|
|
|
|
def run(t):
|
|
here = os.path.dirname(os.path.abspath(t.binary))
|
|
for unit in ("looptest", "fibertest"):
|
|
path = os.path.join(here, unit + (".exe" if os.name == "nt" else ""))
|
|
if not os.path.exists(path):
|
|
t.skip(f"{unit} is built by CMake only")
|
|
continue
|
|
for seed in ("1", "2", "3"):
|
|
try:
|
|
done = subprocess.run([path, seed], stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT, timeout=120)
|
|
except subprocess.TimeoutExpired as exc:
|
|
out = (exc.output or b"").decode(errors="replace")
|
|
t.fail(f"{unit} {seed} finishes",
|
|
actual="last: " + (out.splitlines() or ["nothing"])[-1])
|
|
continue
|
|
out = done.stdout.decode(errors="replace")
|
|
for line in out.splitlines():
|
|
if line.startswith("ok "):
|
|
t.ok(f"{unit} {seed}: {line[3:]}")
|
|
elif line.startswith("FAIL "):
|
|
label, _, what = line[5:].partition(": ")
|
|
t.fail(f"{unit} {seed}: {label}", actual=what)
|
|
if done.returncode and "FAIL " not in out:
|
|
t.fail(f"{unit} {seed} exits cleanly", 0, done.returncode)
|