1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 23:42:20 +08:00

introduce concept of filedescriptors to mfs, adjust fuse code to use them

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2016-02-03 20:45:12 -08:00
parent 5474e15e93
commit 4b7e3282f1
10 changed files with 576 additions and 254 deletions

View File

@ -88,7 +88,7 @@ func checkExists(t *testing.T, path string) {
}
}
func closeMount(mnt *fstest.Mount) {
func closeMount(mnt *mountWrap) {
if err := recover(); err != nil {
log.Error("Recovered panic")
log.Error(err)
@ -96,7 +96,18 @@ func closeMount(mnt *fstest.Mount) {
mnt.Close()
}
func setupIpnsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *fstest.Mount) {
type mountWrap struct {
*fstest.Mount
Fs *FileSystem
}
func (m *mountWrap) Close() error {
m.Fs.Destroy()
m.Mount.Close()
return nil
}
func setupIpnsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *mountWrap) {
maybeSkipFuseTests(t)
var err error
@ -129,7 +140,10 @@ func setupIpnsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *fstest.M
t.Fatal(err)
}
return node, mnt
return node, &mountWrap{
Mount: mnt,
Fs: fs,
}
}
func TestIpnsLocalLink(t *testing.T) {