Skip to content

tests: cover the extent-dedupe path; hoist sync() to the harness - #17

Merged
martinus merged 1 commit into
masterfrom
test/extent-dedupe-coverage
Jul 15, 2026
Merged

tests: cover the extent-dedupe path; hoist sync() to the harness#17
martinus merged 1 commit into
masterfrom
test/extent-dedupe-coverage

Conversation

@martinus

Copy link
Copy Markdown
Owner

The @requires_reflink dedupe tests all use identical files → whole-file dedupe, never reaching fiemap_scan_extent()/fiemap_count_shared() (the functions markfasheh#402/#14/#15 rewrote). Adds test_extent_dedupe.py: two files with distinct heads and an identical, separately-extented tail, so only the extent pass can share them. Asserts the tail is shared, data is preserved, and a second pass adds no new sharing.

Honest scope: it can't pin fiemap_scan_extent()'s exact post-dedupe offset — that value is only a hint for the "already-deduped" check, and the kernel byte-verifies every dedupe, so a wrong hint changes neither data nor sharing. It guards the path against crashes and sharing/data regressions (previously zero coverage).

/simplify: the review flagged that _sync() was now copy-pasted across four test files — hoisted it to the harness as sync() and dropped the local copies + unused imports. 43 tests pass.

🤖 Generated with Claude Code

The dedupe tests all use identical files, which take the whole-file
dedupe path and never reach fiemap_scan_extent()/fiemap_count_shared()
(rewritten recently). Add test_extent_dedupe: two files with distinct
heads and an identical, separately-extented tail, so only the extent
pass can share them. It checks the tail gets shared, data is preserved,
and a second pass adds no new sharing. (It can't pin the exact post-dedupe
offset - that's only a hint, and the kernel byte-verifies every dedupe -
so it guards the path against crashes and sharing/data regressions.)

Four test files had a copy-pasted `_sync()`; this would have been the
fifth. Hoist it to the harness as `sync()` and drop the local copies (and
now-unused subprocess imports).

Co-Authored-By: Claude Fable 5 <[email protected]>
@martinus
martinus merged commit 9102011 into master Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant