Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ config.h.in.old
config.log
config.status
aclocal.m4
__pycache__
/proto.h
/proto.h-tstamp
/rsync*.[15]
Expand Down
8 changes: 4 additions & 4 deletions testsuite/hashsearch-collision-skip_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def make_block(perturb_offset: int = -1, fill: int = C_BYTE) -> bytes:

def parse_stats(out: str):
m_delta = re.search(r'hash_hits=(\d+)\s+false_alarms=(\d+)', out)
m_lit = re.search(r'Literal data:\s*([\d,]+)\s*bytes', out)
m_match = re.search(r'Matched data:\s*([\d,]+)\s*bytes', out)
m_lit = re.search(r'Literal data:\s*([\d,.]+)\s*bytes', out)
m_match = re.search(r'Matched data:\s*([\d,.]+)\s*bytes', out)
if not m_delta or not m_lit or not m_match:
test_fail(f"could not find deltasum/stats in rsync output:\n{out}")
return (
int(m_delta.group(1)),
int(m_delta.group(2)),
int(m_lit.group(1).replace(',', '')),
int(m_match.group(1).replace(',', '')),
int(m_lit.group(1).replace(',', '').replace('.', '')),
int(m_match.group(1).replace(',', '').replace('.', '')),
)


Expand Down
8 changes: 4 additions & 4 deletions testsuite/hashsearch-dup-chain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def make_block(perturb_offset: int = -1, fill: int = C_BYTE) -> bytes:

def parse_stats(out: str):
m_delta = re.search(r'hash_hits=(\d+)\s+false_alarms=(\d+)', out)
m_lit = re.search(r'Literal data:\s*([\d,]+)\s*bytes', out)
m_match = re.search(r'Matched data:\s*([\d,]+)\s*bytes', out)
m_lit = re.search(r'Literal data:\s*([\d,.]+)\s*bytes', out)
m_match = re.search(r'Matched data:\s*([\d,.]+)\s*bytes', out)
if not m_delta or not m_lit or not m_match:
test_fail(f"could not find deltasum/stats in rsync output:\n{out}")
return (
int(m_delta.group(1)),
int(m_delta.group(2)),
int(m_lit.group(1).replace(',', '')),
int(m_match.group(1).replace(',', '')),
int(m_lit.group(1).replace(',', '').replace('.', '')),
int(m_match.group(1).replace(',', '').replace('.', '')),
)


Expand Down
18 changes: 9 additions & 9 deletions testsuite/output-options_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def out(*args, want_rc=0, env=None, text=True):
# --- --progress shows a percentage ------------------------------------------
rmtree(TODIR)
p = out('-a', '--progress', f'{src}/', f'{TODIR}/')
progress_re = r'[\d.,]+B\s+100%\s+[\d.,]+(?:[KMGTPE]i?)?B/s\s+\d+:\d\d:\d\d'
progress_re = r'[\d,.]+B\s+100%\s+[\d,.]+(?:[KMGTPE]i?)?B/s\s+\d+:\d\d:\d\d'
if not re.search(progress_re, p.stdout):
test_fail(f"--progress did not show the expected final shape:\n{p.stdout}")

Expand All @@ -116,17 +116,17 @@ def out(*args, want_rc=0, env=None, text=True):
plain = out('-a', '--stats', f'{src}/', f'{TODIR}/').stdout
rmtree(TODIR)
human = out('-a', '-h', '--stats', f'{src}/', f'{TODIR}/').stdout
suffix_re = r'Total file size: [\d.,]+[KMG]'
suffix_re = r'Total file size: [\d,.]+[KMG]'
if not re.search(suffix_re, human):
test_fail(f"-h did not use a human-readable unit suffix:\n{human}")
if re.search(suffix_re, plain):
test_fail(f"--stats without -h unexpectedly used a unit suffix:\n{plain}")

for label, options, progress_re in (
('default', (), r'50[,.]000B\s+100%\s+[\d.,]+[KMGTPE]B/s'),
('default', (), r'50[,.]000B\s+100%\s+[\d,.]+[KMGTPE]B/s'),
('--no-h', ('--no-h',), r'50000B\s+100%\s+\d+B/s'),
('-h', ('-h',), r'50\.0KB\s+100%\s+[\d.,]+[KMGTPE]B/s'),
('-hh', ('-hh',), r'48\.8KiB\s+100%\s+[\d.,]+[KMGTPE]iB/s'),
('-h', ('-h',), r'50[,.]0KB\s+100%\s+[\d,.]+[KMGTPE]B/s'),
('-hh', ('-hh',), r'48[,.]8KiB\s+100%\s+[\d,.]+[KMGTPE]iB/s'),
):
rmtree(TODIR)
progress = out('-a', '--progress', *options, f'{src}/', f'{TODIR}/').stdout
Expand All @@ -135,23 +135,23 @@ def out(*args, want_rc=0, env=None, text=True):

rmtree(TODIR)
human_binary = out('-a', '-hh', '--stats', f'{src}/', f'{TODIR}/').stdout
if 'Total file size: 48.8Ki bytes' not in human_binary:
if not re.search(r'Total file size: 48[,.]8Ki bytes', human_binary):
test_fail(f"-hh did not use dynamic binary-unit precision:\n{human_binary}")

rmtree(src)
rmtree(TODIR)
makepath(src)
make_data_file(src / 'threshold', 1024)
threshold = out('-a', '-hh', '--stats', f'{src}/', f'{TODIR}/').stdout
if 'Total file size: 1.00Ki bytes' not in threshold:
if not re.search(r'Total file size: 1[,.]00Ki bytes', threshold):
test_fail(f"-hh did not show an exact-threshold binary unit:\n{threshold}")

rmtree(src)
rmtree(TODIR)
makepath(src)
make_data_file(src / 'below-threshold', 1000)
below_threshold = out('-a', '-hh', '--stats', f'{src}/', f'{TODIR}/').stdout
if 'Total file size: 1,000 bytes' not in below_threshold:
if not re.search(r'Total file size: 1[,.]000 bytes', below_threshold):
test_fail("-hh should preserve raw byte formatting below the binary-unit "
f"threshold:\n{below_threshold}")

Expand All @@ -162,7 +162,7 @@ def out(*args, want_rc=0, env=None, text=True):
for i in range(999):
(src / f'f{i}').touch()
counts = out('-a', '-hh', '--progress', '--no-i-r', f'{src}/', f'{TODIR}/').stdout
if '1,000 files to consider' not in counts:
if not re.search(r'1[,.]000 files to consider', counts):
test_fail(f"file-list count was not grouped:\n{counts}")
rmtree(TODIR)
counts = out('-a', '--no-h', '--progress', '--no-i-r', f'{src}/', f'{TODIR}/').stdout
Expand Down
4 changes: 3 additions & 1 deletion testsuite/write-touched-blocks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shlex
import subprocess
import sys
import re
from pathlib import Path

from rsyncfns import (
Expand Down Expand Up @@ -82,7 +83,8 @@ def run_client(src_path, dest_path):
proc = run_client(base_file, dest_full)
if proc.returncode != 0:
test_fail(f"rsync failed on full write test:\n{proc.stdout}")
if "Number of 4 KiB logical blocks touched: 1,024\n" not in proc.stdout:
#if "Number of 4 KiB logical blocks touched: 1,024\n" not in proc.stdout:
if not re.search(r'Number of 4 KiB logical blocks touched: 1[,.]024\n', proc.stdout):
test_fail(f"Full write check failed! Expected 1,024 blocks. Output:\n{proc.stdout}")

# TEST 5: Sparse File Write (Hole skipping)
Expand Down
Loading