Repository navigation
Conversation
rami3l
reviewed
Nov 6, 2026
| } | ||
|
|
||
| #[test] | ||
| fn unpack_small_and_streamed_files_immediate() { |
Member
There was a problem hiding this comment.
Nit: Test functions can actually return Result<> so there should be no use in unwrapping here.
| /// Unpack one file below and one above `IO_CHUNK_SIZE`, so that both the | ||
| /// whole-file and the streaming paths are taken, and check their contents. | ||
| fn unpack_small_and_streamed_files(io_threads: usize) -> anyhow::Result<()> { | ||
| let small = b"small file contents".to_vec(); |
Member
There was a problem hiding this comment.
The .to_vec() call here is redundant since later on this variable is used as &small.
Comment on lines
+479
to
+481
| let large = (0..IO_CHUNK_SIZE + 1) | ||
| .map(|i| (i % 251) as u8) | ||
| .collect::<Vec<_>>(); |
Member
There was a problem hiding this comment.
Nit: Consider using array::from_fn() here so you can avoid making a Vec<>.
Comment on lines
+477
to
+478
| // Not all zeros, since a broken stream used to produce NUL bytes | ||
| // (#2754), and with a period that doesn't divide the chunk size. |
Member
There was a problem hiding this comment.
and with a period that doesn't divide the chunk size.
I'm not super sure what this means. Suggest enrich the comments a bit?
|
|
||
| /// Unpack one file below and one above `IO_CHUNK_SIZE`, so that both the | ||
| /// whole-file and the streaming paths are taken, and check their contents. | ||
| fn unpack_small_and_streamed_files(io_threads: usize) -> anyhow::Result<()> { |
Member
There was a problem hiding this comment.
Nit: As per our coding style, the helper function should be put below its callers.
This branch has not been deployed
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.
Closes #2754
Adds a unit test in
src/dist/component/package.rsfor the streaming unpack path. The test builds an in-memory tar with one small file and one file ofIO_CHUNK_SIZE + 1bytes, then unpacks it on both the immediate (1-thread) and threaded (2-thread) executors and checks both files byte for byte.The large file uses a repeating
i % 251pattern rather than zeros, so the NUL-bytes bug from 98365c3 is caught if it comes back. The test usesIoThreadCount::UserSpecifiedbecause withDefault(2),get_executorfalls back to one thread when the RAM budget (32 MiB here) is belowLOW_MEMORY_THRESHOLD(512 MiB).Tested on macOS aarch64: the full test suite (150 unit + 543 integration) passed; clippy and xfmt are clean.
AI disclosure: Claude (AI) wrote the test code and drafted this description.