Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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