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

Public constructors for Request and Reply types #116

Open
asomers opened this issue Oct 27, 2018 · 3 comments
Open

Public constructors for Request and Reply types #116

asomers opened this issue Oct 27, 2018 · 3 comments

Comments

@asomers
Copy link
Contributor

asomers commented Oct 27, 2018

It would be nice to be able to unit test my filesystem's FUSE interface. Right now the only way to test it is to mount an actual filesystem and use the command line. But if rust-fuse did the following, then I would be able to write tests that hook into my filesystem's rust-fuse interface and exercise the whole API. This would require:

  • Public constructor (possibly Default for Request)
  • Public constructors for all the various Reply types.
  • Public accessors for the various Reply types, for example to see the data stored by ReplyData::data.
@chisa0a
Copy link

chisa0a commented Apr 24, 2019

So much this.

Trying to use rust-fuse as a library crate is all but impossible atm. Would this be a better suited task for implementing a high-level API?

New to the library, and to Rust, and would really love to use rust-fuse in a project. Happy to contribute where I can.

Many thanks in advance.

@zargony
Copy link
Owner

zargony commented Apr 24, 2019

Back then when rust-fuse was created, we intentionally chose to have no public constructors to ensure that implementations comply with what the kernel protocol requires. Nowadays the interface on the Rust side still works the same but looks a bit unusual. There's ongoing effort (e.g. in #90 and the modernize branch) to make rust-fuse more idiomatic and especially add async and testing capability. I suppose that request and reply types will completely change so that this issue won't apply anymore. But afaik there is no issue specific to testability yet, so if you edit this issue to be more generic towards the new implementation, we could use it for collecting ideas and tracking progress of making fuse implementation testing easier.

@asomers
Copy link
Contributor Author

asomers commented Apr 24, 2019

I've been working on a new approach to testing crates that use rust-fuse. I'm using mockall to create mock versions of each Request and Reply type. Then I have to redefine FileSystem to take these mock types instead of the real ones. It's a lot of boilerplate, but it seems to work.

asomers added a commit to bfffs/bfffs that referenced this issue Sep 20, 2019
common::fs::Fs has unit tests for empty reads, but it's currently impossible
to unit test fuse::fs because of
zargony/fuse-rs#116

Reported-by: fsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants