test: differential st_blocks for --sparse/--preallocate and --ignore-existing wire volume
- Assert FastSync's sparse/preallocate block accounting matches rsync 3.4.1 for a hole file (preallocate wins over sparse, exactly like rsync). - Assert --ignore-existing is answered by the receiver before the sender transmits the payload (CountingProxy wire volume near-zero). - CountingProxy.run gains a bounded join_timeout so tests that only need the client->server count do not wait for the server's idle socket. - Fix the stale protocol 2.24.0 comment in test_config.c (golden is 2.26.0).
This commit is contained in:
@@ -101,9 +101,15 @@ class CountingProxy:
|
||||
return
|
||||
counter[0] += len(data)
|
||||
|
||||
def run(self, cmd):
|
||||
def run(self, cmd, join_timeout=20):
|
||||
"""Forward one client run (the full command list) to the real server and
|
||||
return the CompletedProcess after the counts have settled."""
|
||||
return the CompletedProcess after the counts have settled.
|
||||
|
||||
``join_timeout`` bounds how long to wait for the forwarding threads. The
|
||||
client->server count is published as soon as the client side reaches EOF
|
||||
(i.e. once the client process has exited), so callers that only need that
|
||||
count can pass a small value instead of waiting for the server to close
|
||||
its idle socket."""
|
||||
|
||||
def serve():
|
||||
try:
|
||||
@@ -119,15 +125,15 @@ class CountingProxy:
|
||||
a.start()
|
||||
b.start()
|
||||
a.join()
|
||||
b.join()
|
||||
self.client_to_server = c2s[0]
|
||||
b.join()
|
||||
self.server_to_client = s2c[0]
|
||||
self._listener.close()
|
||||
|
||||
thread = threading.Thread(target=serve)
|
||||
thread = threading.Thread(target=serve, daemon=True)
|
||||
thread.start()
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=180)
|
||||
thread.join(20)
|
||||
thread.join(join_timeout)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user