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
}
func setupCacheTest(t *testing.T) (string, *PathNodeFs, func()) {
dir, err := ioutil.TempDir("", "go-fuse")
dir, err := ioutil.TempDir("", "go-fuse-cachetest")
if err != nil {
t.Fatalf("TempDir failed: %v", err)
}
......@@ -134,7 +134,7 @@ func TestNonseekable(t *testing.T) {
fs := &nonseekFs{}
fs.Length = 200 * 1024
dir, err := ioutil.TempDir("", "go-fuse")
dir, err := ioutil.TempDir("", "go-fuse-cache_test")
if err != nil {
t.Fatalf("failed: %v", err)
}
......@@ -163,7 +163,7 @@ func TestNonseekable(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 {
t.Fatalf("failed: %v", err)
}
......
......@@ -26,7 +26,7 @@ func (f *flipNode) GetAttr(out *Attr, file File, c *Context) Status {
}
func TestDeleteNotify(t *testing.T) {
dir, err := ioutil.TempDir("", "")
dir, err := ioutil.TempDir("", "go-fuse-delete_test")
if err != nil {
t.Fatalf("TempDir failed %v", err)
}
......
......@@ -131,7 +131,7 @@ func NewFile() *MutableDataFile {
}
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 {
t.Fatalf("TempDir failed: %v", err)
}
......
......@@ -898,7 +898,7 @@ func TestFStatFs(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 {
t.Fatalf("TempDir failed: %v", err)
}
......
......@@ -10,7 +10,7 @@ import (
var _ = log.Println
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 {
t.Fatalf("TempDir failed: %v", err)
}
......
......@@ -8,7 +8,7 @@ import (
)
func TestLinkAt(t *testing.T) {
dir, _ := ioutil.TempDir("", "go-fuse")
dir, _ := ioutil.TempDir("", "go-fuse-misc_test")
ioutil.WriteFile(dir+"/a", []byte{42}, 0644)
f, _ := os.Open(dir)
e := Linkat(int(f.Fd()), "a", int(f.Fd()), "b")
......
......@@ -45,7 +45,7 @@ func NewNotifyTest(t *testing.T) *NotifyTest {
me := &NotifyTest{}
me.fs = &NotifyFs{}
var err error
me.dir, err = ioutil.TempDir("", "go-fuse")
me.dir, err = ioutil.TempDir("", "go-fuse-notify_test")
if err != nil {
t.Fatalf("TempDir failed: %v", err)
}
......
......@@ -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()) {
wd, err := ioutil.TempDir("", "go-fuse")
wd, err := ioutil.TempDir("", "go-fuse-owner_test")
fs := &ownerFs{}
nfs := NewPathNodeFs(fs, nil)
......
......@@ -41,10 +41,11 @@ func TestMemoryPressure(t *testing.T) {
dirRegex: regexp.MustCompile("^dir[0-9]*$"),
}
dir, err := ioutil.TempDir("", "go-fuse")
dir, err := ioutil.TempDir("", "go-fuse-pressure_test")
if err != nil {
t.Fatalf("TempDir failed: %v", err)
}
defer os.RemoveAll(dir)
nfs := NewPathNodeFs(fs, nil)
o := &FileSystemOptions{PortableInodes: true}
......
......@@ -103,11 +103,10 @@ func readXAttr(p, a string) (val []byte, errno int) {
func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func()) {
xfs := NewXAttrFs(nm, xattrGolden)
xfs.tester = t
mountPoint, err := ioutil.TempDir("", "go-fuse")
mountPoint, err := ioutil.TempDir("", "go-fuse-xattr_test")
if err != nil {
t.Fatalf("TempDir failed: %v", err)
}
defer os.RemoveAll(mountPoint)
nfs := NewPathNodeFs(xfs, nil)
state, _, err := MountNodeFileSystem(mountPoint, nfs, nil)
......@@ -117,7 +116,10 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func())
state.Debug = VerboseTest()
go state.Loop()
return mountPoint, func() { state.Unmount() }
return mountPoint, func() {
state.Unmount()
os.RemoveAll(mountPoint)
}
}
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