]> git.ipfire.org Git - thirdparty/rsync.git/commit
testsuite: add claim_ports() for parallel-safe TCP-port coordination
authorAndrew Tridgell <andrew@tridgell.net>
Thu, 21 May 2026 01:47:44 +0000 (11:47 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Fri, 22 May 2026 04:34:52 +0000 (14:34 +1000)
commitbf8aab51e8cd1879f98564698e26d732e0a66370
tree94a16746f06c8a808b96da41ccd52af0d485aa86
parent1f689ec0c21b7c2eaa9add1958d2c7ed280aac3e
testsuite: add claim_ports() for parallel-safe TCP-port coordination

rsyncfns.claim_ports(*ports) takes exclusive POSIX byte-range locks on
/tmp/rsync_test.lck (offset = port number) so any number of test
processes can run concurrently without colliding on a TCP port: a test
asking for a port already held blocks until the holder exits. The
kernel drops the locks automatically when the holding process dies, so
a crashed test releases its ports with no manual cleanup.

Ports are claimed in sorted order so two callers requesting the same
set in different orders can't deadlock. The lock file is forced to
mode 0o666 after creation (the umask would otherwise trim it and lock
out a second user on a shared CI runner; EPERM when we're not the
owner is fine).

proxy-response-line-too-long is the first user: it switches from an
ephemeral port to a claimed fixed port (12873).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
testsuite/proxy-response-line-too-long_test.py
testsuite/rsyncfns.py