Commit f7f8b159 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: cleanup all temp directories.

parent 3ce04011
...@@ -29,7 +29,7 @@ func (fs *cacheFs) Open(name string, flags uint32, context *Context) (fuseFile F ...@@ -29,7 +29,7 @@ func (fs *cacheFs) Open(name string, flags uint32, context *Context) (fuseFile F
} }
func setupCacheTest(t *testing.T) (string, *PathNodeFs, func()) { func setupCacheTest(t *testing.T) (string, *PathNodeFs, func()) {
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse-cachetest")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
...@@ -134,7 +134,7 @@ func TestNonseekable(t *testing.T) { ...@@ -134,7 +134,7 @@ func TestNonseekable(t *testing.T) {
fs := &nonseekFs{} fs := &nonseekFs{}
fs.Length = 200 * 1024 fs.Length = 200 * 1024
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse-cache_test")
if err != nil { if err != nil {
t.Fatalf("failed: %v", err) t.Fatalf("failed: %v", err)
} }
...@@ -163,7 +163,7 @@ func TestNonseekable(t *testing.T) { ...@@ -163,7 +163,7 @@ func TestNonseekable(t *testing.T) {
} }
func TestGetAttrRace(t *testing.T) { func TestGetAttrRace(t *testing.T) {
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse-cache_test")
if err != nil { if err != nil {
t.Fatalf("failed: %v", err) t.Fatalf("failed: %v", err)
} }
......
...@@ -26,7 +26,7 @@ func (f *flipNode) GetAttr(out *Attr, file File, c *Context) Status { ...@@ -26,7 +26,7 @@ func (f *flipNode) GetAttr(out *Attr, file File, c *Context) Status {
} }
func TestDeleteNotify(t *testing.T) { func TestDeleteNotify(t *testing.T) {
dir, err := ioutil.TempDir("", "") dir, err := ioutil.TempDir("", "go-fuse-delete_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed %v", err) t.Fatalf("TempDir failed %v", err)
} }
......
...@@ -131,7 +131,7 @@ func NewFile() *MutableDataFile { ...@@ -131,7 +131,7 @@ func NewFile() *MutableDataFile {
} }
func setupFAttrTest(t *testing.T, fs FileSystem) (dir string, clean func(), sync func()) { func setupFAttrTest(t *testing.T, fs FileSystem) (dir string, clean func(), sync func()) {
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse-fsetattr_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
......
...@@ -898,7 +898,7 @@ func TestFStatFs(t *testing.T) { ...@@ -898,7 +898,7 @@ func TestFStatFs(t *testing.T) {
} }
func TestOriginalIsSymlink(t *testing.T) { func TestOriginalIsSymlink(t *testing.T) {
tmpDir, err := ioutil.TempDir("", "go-fuse") tmpDir, err := ioutil.TempDir("", "go-fuse-loopback_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
var _ = log.Println var _ = log.Println
func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) { func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) {
tmp, err := ioutil.TempDir("", "go-fuse") tmp, err := ioutil.TempDir("", "go-fuse-memnode_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
) )
func TestLinkAt(t *testing.T) { func TestLinkAt(t *testing.T) {
dir, _ := ioutil.TempDir("", "go-fuse") dir, _ := ioutil.TempDir("", "go-fuse-misc_test")
ioutil.WriteFile(dir+"/a", []byte{42}, 0644) ioutil.WriteFile(dir+"/a", []byte{42}, 0644)
f, _ := os.Open(dir) f, _ := os.Open(dir)
e := Linkat(int(f.Fd()), "a", int(f.Fd()), "b") e := Linkat(int(f.Fd()), "a", int(f.Fd()), "b")
......
...@@ -45,7 +45,7 @@ func NewNotifyTest(t *testing.T) *NotifyTest { ...@@ -45,7 +45,7 @@ func NewNotifyTest(t *testing.T) *NotifyTest {
me := &NotifyTest{} me := &NotifyTest{}
me.fs = &NotifyFs{} me.fs = &NotifyFs{}
var err error var err error
me.dir, err = ioutil.TempDir("", "go-fuse") me.dir, err = ioutil.TempDir("", "go-fuse-notify_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
......
...@@ -28,7 +28,7 @@ func (fs *ownerFs) GetAttr(name string, context *Context) (*Attr, Status) { ...@@ -28,7 +28,7 @@ func (fs *ownerFs) GetAttr(name string, context *Context) (*Attr, Status) {
} }
func setupOwnerTest(t *testing.T, opts *FileSystemOptions) (workdir string, cleanup func()) { func setupOwnerTest(t *testing.T, opts *FileSystemOptions) (workdir string, cleanup func()) {
wd, err := ioutil.TempDir("", "go-fuse") wd, err := ioutil.TempDir("", "go-fuse-owner_test")
fs := &ownerFs{} fs := &ownerFs{}
nfs := NewPathNodeFs(fs, nil) nfs := NewPathNodeFs(fs, nil)
......
...@@ -41,10 +41,11 @@ func TestMemoryPressure(t *testing.T) { ...@@ -41,10 +41,11 @@ func TestMemoryPressure(t *testing.T) {
dirRegex: regexp.MustCompile("^dir[0-9]*$"), dirRegex: regexp.MustCompile("^dir[0-9]*$"),
} }
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse-pressure_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
defer os.RemoveAll(dir)
nfs := NewPathNodeFs(fs, nil) nfs := NewPathNodeFs(fs, nil)
o := &FileSystemOptions{PortableInodes: true} o := &FileSystemOptions{PortableInodes: true}
......
...@@ -103,11 +103,10 @@ func readXAttr(p, a string) (val []byte, errno int) { ...@@ -103,11 +103,10 @@ func readXAttr(p, a string) (val []byte, errno int) {
func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func()) { func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func()) {
xfs := NewXAttrFs(nm, xattrGolden) xfs := NewXAttrFs(nm, xattrGolden)
xfs.tester = t xfs.tester = t
mountPoint, err := ioutil.TempDir("", "go-fuse") mountPoint, err := ioutil.TempDir("", "go-fuse-xattr_test")
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
defer os.RemoveAll(mountPoint)
nfs := NewPathNodeFs(xfs, nil) nfs := NewPathNodeFs(xfs, nil)
state, _, err := MountNodeFileSystem(mountPoint, nfs, nil) state, _, err := MountNodeFileSystem(mountPoint, nfs, nil)
...@@ -117,7 +116,10 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func()) ...@@ -117,7 +116,10 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func())
state.Debug = VerboseTest() state.Debug = VerboseTest()
go state.Loop() go state.Loop()
return mountPoint, func() { state.Unmount() } return mountPoint, func() {
state.Unmount()
os.RemoveAll(mountPoint)
}
} }
func TestXAttrNoExist(t *testing.T) { func TestXAttrNoExist(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment