Commit 954bbbc5 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys Committed by Han-Wen Nienhuys

fs: use testing.TempDir

Change-Id: Ia0d7293d14bb4fdac9be913ba6bd92b836636070
parent ba08cb01
...@@ -79,11 +79,7 @@ func TestForget(t *testing.T) { ...@@ -79,11 +79,7 @@ func TestForget(t *testing.T) {
EntryTimeout: &sec, EntryTimeout: &sec,
} }
options.Debug = testutil.VerboseTest() options.Debug = testutil.VerboseTest()
dir, err := ioutil.TempDir("", "TestForget") dir := t.TempDir()
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
rawFS := NewNodeFS(root, options) rawFS := NewNodeFS(root, options)
server, err := fuse.NewServer(rawFS, dir, &options.MountOptions) server, err := fuse.NewServer(rawFS, dir, &options.MountOptions)
......
...@@ -17,16 +17,8 @@ import ( ...@@ -17,16 +17,8 @@ import (
) )
func TestWindowsEmulations(t *testing.T) { func TestWindowsEmulations(t *testing.T) {
mntDir, err := ioutil.TempDir("", "ZipFS") mntDir := t.TempDir()
if err != nil { origDir := t.TempDir()
t.Fatal(err)
}
defer os.RemoveAll(mntDir)
origDir, err := ioutil.TempDir("", "ZipFS")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(origDir)
rootData := &fs.LoopbackRoot{ rootData := &fs.LoopbackRoot{
NewNode: newWindowsNode, NewNode: newWindowsNode,
......
...@@ -59,10 +59,7 @@ func TestZipFS(t *testing.T) { ...@@ -59,10 +59,7 @@ func TestZipFS(t *testing.T) {
} }
root := &zipRoot{zr: r} root := &zipRoot{zr: r}
mntDir, err := ioutil.TempDir("", "ZipFS") mntDir := t.TempDir()
if err != nil {
t.Fatal(err)
}
server, err := fs.Mount(mntDir, root, nil) server, err := fs.Mount(mntDir, root, nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -108,10 +105,7 @@ func TestZipFSOnAdd(t *testing.T) { ...@@ -108,10 +105,7 @@ func TestZipFSOnAdd(t *testing.T) {
zr := &zipRoot{zr: r} zr := &zipRoot{zr: r}
root := &fs.Inode{} root := &fs.Inode{}
mnt, err := ioutil.TempDir("", "ZipFS") mnt := t.TempDir()
if err != nil {
t.Fatal(err)
}
server, err := fs.Mount(mnt, root, &fs.Options{ server, err := fs.Mount(mnt, root, &fs.Options{
OnAdd: func(ctx context.Context) { OnAdd: func(ctx context.Context) {
root.AddChild("sub", root.AddChild("sub",
......
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