TEST: build the ZIP fixture little-endian in the local-header test#114
Open
Scottcjn wants to merge 1 commit into
Open
TEST: build the ZIP fixture little-endian in the local-header test#114Scottcjn wants to merge 1 commit into
Scottcjn wants to merge 1 commit into
Conversation
test_load_zip_with_local_header_extra_field hand-builds a ZIP and wrote
the positions/offsets arrays with `.tobytes()`, which serializes in
native byte order. The TRX format stores arrays little-endian on disk
(see `_get_dtype_little_endian` / `_ensure_little_endian`), and the
reader decodes them little-endian — so on a big-endian host (s390x) the
fixture wrote big-endian bytes that the reader then byte-swapped, and the
test failed with mismatched values.
Serialize the fixture arrays explicitly as little-endian
(`astype("<f4")` / `astype("<u8")`) so the test is valid regardless of
host endianness. Library code is unchanged.
Fixes tee-ar-ex#113
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #113 —
test_load_zip_with_local_header_extra_fieldfails on s390x (and any big-endian host).The test hand-builds a ZIP fixture and wrote the
positions/offsetsarrays with.tobytes(), which serializes in native byte order. The TRX format stores arrays little-endian on disk (_get_dtype_little_endian/_ensure_little_endian), and the loader decodes them little-endian. So on a big-endian host the fixture wrote big-endian bytes that the (correct) reader then byte-swapped — the test failed with mismatched streamline values.This is a test-fixture bug, not a library bug: the library's read and write paths are both consistently little-endian.
Fix
Serialize the fixture arrays explicitly as little-endian —
positions.astype("<f4").tobytes()andoffsets.astype("<u8").tobytes()— so the hand-built ZIP is a valid TRX file regardless of host endianness. The ZIP headers were already written with explicit little-endianstruct.pack("<..."); library code is untouched.Verification
test_memmap.pysuite passes on x86_64 (83 passed) — no regression..tobytes()of a big-endian array does not match the little-endian on-disk form, while.astype("<f4").tobytes()does.