mirage / index

A platform-agnostic multi-level index
MIT License
33 stars 20 forks source link

Support for short read/write pread/pwrite should be tested more #376

Open tomjridge opened 3 years ago

tomjridge commented 3 years ago

Support for short read/write pread/pwrite should be tested more.

I vaguely recall a FUSE filesystem that could make all read/write calls into short read/write calls, and could also do various other kinds of filesystem-allowed-but-rarely-tested behaviours. Would be good to find this and use it in testing.

tomjridge commented 3 years ago

(And this issue could also be made for Irmin)

Ngoguey42 commented 3 years ago

Could be related to https://github.com/mirage/irmin/issues/1197

tomjridge commented 3 years ago

Possibly also related to #256

tomjridge commented 3 years ago

I have been attempting to encourage the filesystem to return "short" reads and writes, so we can test these behaviours easily.

One thing I tried was to use "max_read" and "max_write" FUSE options with a passthrough FUSE filesystem. Unfortunately (at least for the fusexmp from ocamlfuse) these options do not seem to be respected.

Other possibly-related bugs appeared on WSL running a 9p FS. I tried to reproduce on Linux using diod (a 9p server/client). However, the tests all passed (unfortunately). So, in terms of trying to elicit errors, diod is worse than WSL 9p.

Effectively all we want is for read/write (or pread/pwrite) to return short read/writes. I researched quite a lot on the web because I thought there was a tool that could do this. Unfortunately I couldn't find one. So I will spend another hour or so coding a FUSE passthrough FS with this "short read/write" behaviour. If the tests still pass then at least we have confidence that our code is well tested under this scenario.