unit-testinggofilesystemsfuse

How to unit test a FUSE filesystem implementation?


I am writing a FUSE implementation of a filesystem in GO, that needs to support most major features such as locks, symlinks, modes, permissions etc.

Is there some kind of library or tool (not necessarily written in GO), that could perform proper tests to ensure the filesystem behaves as it should?

Ideally I could simply point it to a folder on which I've mounted the filesystem, tell it which tests are "OK" to fail (missing or unsupported features) and just run it.

I did an extensive search on this, but most results that come up are libraries for mocking a filesystem to use for testing, but not for testing the actual filesystem.


Solution

  • Take a look at libfuse own's tests folder https://github.com/libfuse/libfuse/tree/master/test. You will find there tests of libfuse example file systems which are being actually mounted and tested as you are looking for.

    Another good reference is "xfstests" suite: https://github.com/kdave/xfstests. It is meant to verify any given file system complies with a set of testable requirements. You could run a subset of it and tweak it to your need.