mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 07:29:35 +01:00
mounttest: run the tests for all 4 VFS cache modes
This commit is contained in:
parent
d7908c06c9
commit
57a5c67729
@ -129,6 +129,8 @@ func mount(f fs.Fs, mountpoint string) (*vfs.VFS, <-chan error, func() error, er
|
||||
|
||||
// unmount
|
||||
unmount := func() error {
|
||||
// Shutdown the VFS
|
||||
fsys.VFS.Shutdown()
|
||||
fs.Debugf(nil, "Calling host.Unmount")
|
||||
if host.Unmount() {
|
||||
fs.Debugf(nil, "host.Unmount succeeded")
|
||||
|
@ -100,6 +100,8 @@ func mount(f fs.Fs, mountpoint string) (*vfs.VFS, <-chan error, func() error, er
|
||||
}
|
||||
|
||||
unmount := func() error {
|
||||
// Shutdown the VFS
|
||||
filesys.VFS.Shutdown()
|
||||
return fuse.Unmount(mountpoint)
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
_ "github.com/ncw/rclone/fs/all" // import all the file systems
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/ncw/rclone/vfs"
|
||||
"github.com/ncw/rclone/vfs/vfsflags"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -38,9 +39,25 @@ var (
|
||||
func TestMain(m *testing.M, fn MountFn) {
|
||||
mountFn = fn
|
||||
flag.Parse()
|
||||
run = newRun()
|
||||
rc := m.Run()
|
||||
run.Finalise()
|
||||
var rc int
|
||||
cacheModes := []vfs.CacheMode{
|
||||
vfs.CacheModeOff,
|
||||
vfs.CacheModeMinimal,
|
||||
vfs.CacheModeWrites,
|
||||
vfs.CacheModeFull,
|
||||
}
|
||||
for _, cacheMode := range cacheModes {
|
||||
vfsflags.Opt.CacheMode = cacheMode
|
||||
log.Printf("Starting test run with cache mode %v", cacheMode)
|
||||
run = newRun()
|
||||
rc = m.Run()
|
||||
run.Finalise()
|
||||
log.Printf("Finished test run with cache mode %v", cacheMode)
|
||||
if rc != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
vfsflags.Opt.CacheMode = vfs.DefaultOpt.CacheMode
|
||||
os.Exit(rc)
|
||||
}
|
||||
|
||||
@ -147,6 +164,12 @@ func (r *Run) umount() {
|
||||
if err != nil {
|
||||
log.Fatalf("umount failed: %v", err)
|
||||
}
|
||||
|
||||
// Cleanup the VFS cache - umount has called Shutdown
|
||||
err = r.vfs.CleanUp()
|
||||
if err != nil {
|
||||
log.Printf("Failed to cleanup the VFS cache: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Run) skipIfNoFUSE(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user