Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[network] better systematic testing of fragmented read/writes #6366

Open
phlip9 opened this issue Oct 4, 2020 · 0 comments
Open

[network] better systematic testing of fragmented read/writes #6366

phlip9 opened this issue Oct 4, 2020 · 0 comments

Comments

@phlip9
Copy link
Contributor

@phlip9 phlip9 commented Oct 4, 2020

We have a bunch of code in network that reads/writes to sockets or io-like objects (or even presents an io-like interface), e.g., noise::stream or version handshake. Since IO reads/writes can be fragmented (i.e., I write(&[1,2,3,4]) but it only writes the first 2 bytes), we want to make sure our logic handles this edge case. We also have some basic test utils like the various fake_socket's that support basic fragmented reads (it splits all reads into read 1 byte) from a fixed buffer, which probably catch most dumb mistakes. However, I think we can take a more systematic approach and use proptest to sample a sequence of Read(n)/Write(n) ops and use these to determine the sizes of each fragmented read/write.

Luckily, a useful crate just popped up on my radar that seems to do exactly this: https://github.com/facebookincubator/rust-partial-io

It needs some small work to support proptest instead of quickcheck, but otherwise looks good.

@gregnazario @mimoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.