TEST: build the ZIP fixture little-endian in the local-header test#114
Merged
skoudoro merged 2 commits intoJun 13, 2026
Merged
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) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #114 +/- ##
=======================================
Coverage 61.64% 61.64%
=======================================
Files 13 13
Lines 2623 2623
=======================================
Hits 1617 1617
Misses 1006 1006
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
skoudoro
reviewed
Jun 5, 2026
Comment on lines
+526
to
+527
| # TRX stores arrays little-endian on disk; serialize the fixture | ||
| # explicitly so it is valid on big-endian hosts too (issue #113). |
Collaborator
There was a problem hiding this comment.
Can you remove the comments.
Thanks !
arokem
reviewed
Jun 13, 2026
Collaborator
|
Is this ready to go now, @skoudoro ? |
Collaborator
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.