fix(tools): h5rs check says why the library refused a file

With the header checks merged, the library refuses truncated files and
misaligned chunk-index keys itself, so check reported only "file cannot
be opened" for a truncated file. It now reports the truncation (stored
end of file vs file length) or the library's error, and the misaligned
chunk test accepts the library's refusal of the key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-26 01:46:48 -05:00
co-authored by Claude Opus 5.5
parent e60bde3579
commit 72306c6013
2 changed files with 21 additions and 2 deletions
+4 -1
View File
@@ -741,8 +741,11 @@ fn check_flags_a_misaligned_chunk() {
let o = h5rs(&["check", &bad.to_string_lossy()]);
let s = stdout(&o);
assert_eq!(code(&o), 1, "{s}");
// The library's chunk-index reader refuses the key first (as libhdf5
// does); either way the problem is reported against the dataset.
assert!(
s.contains("/grp/gz: chunk at [103, 0] offset 103 in dimension 0 is not a multiple of the chunk size 100"),
s.contains("/grp/gz: chunk at [103, 0] offset 103 in dimension 0 is not a multiple of the chunk size 100")
|| s.contains("/grp/gz: chunk index (v1 B-tree): chunked read error: bad coordinate offset [103, 0] for chunk dimensions [100, 4]"),
"{s}"
);
}