From 1a550bda244e0fee35216f434749d72b4769dab3 Mon Sep 17 00:00:00 2001 From: TapTap Date: Thu, 17 Sep 2026 01:30:09 +0200 Subject: [PATCH] test: pin delta-mode %c divergence against rsync Add test_out_format_c_delta_mode_divergence documenting that FastSync's delta %c (its own handshake bytes) cannot match rsync's (16-byte sum header plus per-block checksums); only the whole-file case is aligned. The test pins both values so a future parity improvement is noticed. --- tests/integration/test_output_parity.py | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/integration/test_output_parity.py b/tests/integration/test_output_parity.py index 1b2bf7b..83f54bb 100644 --- a/tests/integration/test_output_parity.py +++ b/tests/integration/test_output_parity.py @@ -382,6 +382,41 @@ class TestWireStatsParity: f"%c must be rsync's 16-byte sum header: {result.stdout!r}" ) + @requires_rsync + @pytest.mark.ci + def test_out_format_c_delta_mode_divergence(self, shared_server): + """Documented residual: with delta enabled, rsync's %c is its 16-byte sum + header plus one checksum entry per block (protocol-specific, so it grows + with the basis size), while FastSync's %c is the bytes of its own delta + handshake. FastSync's delta %c therefore cannot match rsync numerically; + only the whole-file case is aligned. Pinned here so a future change is + noticed.""" + source = os.path.join(TEST_DATA_DIR, "wire_cd_src") + dest = os.path.join(TEST_DATA_DIR, "wire_cd_dst") + rdst = os.path.join(TEST_DATA_DIR, "wire_cd_rdst") + _make_one_file(source, "f.bin", 5000) + clean_dir(dest) + clean_dir(rdst) + fmt = "%c %l" + # rsync local default is whole-file; force the block-delta path. + rsync_result = _rsync(["-a", "--no-whole-file", "--out-format=" + fmt, + source + "/", rdst + "/"]) + assert rsync_result.returncode == 0, rsync_result.stderr + result, _ = run_client(source, dest, + flags=["-a", "--incremental", "--delta", + "--out-format=" + fmt], + port=shared_server.port) + assert result.returncode == 0, result.stderr[:300] + rs_c = int(rsync_result.stdout.split()[0]) + fs_c = int(result.stdout.split()[0]) + # No basis exists, so rsync still reports only its sum header. + assert rs_c == 16, rsync_result.stdout + # FastSync reports its own handshake bytes and is not aligned. + assert fs_c > 16, ( + f"FastSync delta %c changed to {fs_c}; the documented divergence " + "may be closable now" + ) + @requires_rsync @pytest.mark.ci @pytest.mark.parametrize("mt", [False, True])