Repository navigation
Tests: get, put, cp and hash keep every byte of a binary file - #127
Merged
Merged
Conversation
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.
A model file such as a .espdl holds every byte value and long runs of zeros. mpftp sends and receives file content through printed reprs that mpremote parses on the host, so a step that treats the content as text, or passes it through eval or compile, fails on a null byte with "source code string cannot contain null bytes".
These tests run the real CLI and sidecar commands (put, get with and without verify, get -r, cp in all three directions, hash) against a stand-in board that executes mpremote's own board-side code under CPython, and compare sha256 of a file holding all 256 byte values, 1,000 zeros in a row and noise. No board needed. They run against both mpremote versions CI installs.
I also ran put, get, get -r, cp and hash on the same kinds of files (6.7 KB, and 1.5 MB with a 4 KB run of zeros) through the desktop MicroPython and CircuitPython interpreters, and every file came back byte-exact on both. A planted bug that routes the bytes through eval makes the new tests fail with the error above.