Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mockable I/O#1110

Closed
divergentdave wants to merge 7 commits into
spacejam:masterfrom
divergentdave:david_mockable_io
Closed

Mockable I/O#1110
divergentdave wants to merge 7 commits into
spacejam:masterfrom
divergentdave:david_mockable_io

Conversation

@divergentdave
Copy link
Copy Markdown
Collaborator

@divergentdave divergentdave commented Jun 23, 2020

Here's an initial effort at adding an indirection layer to all I/O, so that it can be mocked or traced. The approach I'm using here is to put a trait object in the Config to handle all top-level filesystem interactions, and to make open file handles trait objects as well. There are currently two sets of implementations for these traits, one for the real operating system, and a simple mock file system for testing. The mocks lean heavily on mutexes for now, concurrent file operations are future work. strace reports that the test using mocked I/O does not touch the operating system! Tracing is not yet supported, but it would fit naturally as wrapper implementations of the I/O traits. Something in these changes seems to cause a significant performance penalty on the benchmarks, so non-test performance is an open issue too.

See also #1077. Some of the changes here also appear in #1108.

@divergentdave divergentdave marked this pull request as draft June 23, 2020 05:08
@divergentdave divergentdave deleted the david_mockable_io branch January 26, 2022 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant