Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
8363cf88
Commit
8363cf88
authored
Apr 03, 2023
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/testutil: drop TempDir
Change-Id: I9357f137487d1c958a95ed46db081b7775604b6b
parent
bd47fe9b
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
47 additions
and
160 deletions
+47
-160
benchmark/stat_test.go
benchmark/stat_test.go
+8
-5
fs/loopback_linux_test.go
fs/loopback_linux_test.go
+1
-2
fs/mem_test.go
fs/mem_test.go
+1
-4
fs/simple_test.go
fs/simple_test.go
+2
-6
fuse/pathfs/copy_test.go
fuse/pathfs/copy_test.go
+2
-7
fuse/pathfs/owner_test.go
fuse/pathfs/owner_test.go
+1
-2
fuse/pathfs/xattr_test.go
fuse/pathfs/xattr_test.go
+1
-3
fuse/test/cache_test.go
fuse/test/cache_test.go
+4
-9
fuse/test/cachecontrol_test.go
fuse/test/cachecontrol_test.go
+1
-7
fuse/test/defaultnode_test.go
fuse/test/defaultnode_test.go
+1
-2
fuse/test/defaultread_test.go
fuse/test/defaultread_test.go
+1
-3
fuse/test/delete_linux_test.go
fuse/test/delete_linux_test.go
+1
-2
fuse/test/file_lock_test.go
fuse/test/file_lock_test.go
+3
-13
fuse/test/fsetattr_test.go
fuse/test/fsetattr_test.go
+1
-3
fuse/test/loopback_linux_test.go
fuse/test/loopback_linux_test.go
+3
-6
fuse/test/loopback_test.go
fuse/test/loopback_test.go
+2
-4
fuse/test/mount_test.go
fuse/test/mount_test.go
+2
-5
fuse/test/nil_file_truncation_test.go
fuse/test/nil_file_truncation_test.go
+1
-7
fuse/test/node_parallel_lookup_test.go
fuse/test/node_parallel_lookup_test.go
+1
-8
fuse/test/node_test.go
fuse/test/node_test.go
+1
-1
fuse/test/nofile_test.go
fuse/test/nofile_test.go
+1
-8
fuse/test/notify_linux_test.go
fuse/test/notify_linux_test.go
+1
-1
fuse/test/umask_test.go
fuse/test/umask_test.go
+1
-1
fuse/test/xattr_test.go
fuse/test/xattr_test.go
+2
-5
internal/testutil/tempdir.go
internal/testutil/tempdir.go
+0
-38
newunionfs/unionfs_test.go
newunionfs/unionfs_test.go
+1
-2
zipfs/multizip_test.go
zipfs/multizip_test.go
+1
-2
zipfs/tarfs_test.go
zipfs/tarfs_test.go
+1
-2
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+1
-2
No files found.
benchmark/stat_test.go
View file @
8363cf88
...
...
@@ -25,7 +25,10 @@ import (
func
setupFs
(
node
fs
.
InodeEmbedder
,
N
int
)
(
string
,
func
())
{
opts
:=
&
fs
.
Options
{}
opts
.
Debug
=
testutil
.
VerboseTest
()
mountPoint
:=
testutil
.
TempDir
()
mountPoint
,
err
:=
os
.
MkdirTemp
(
""
,
""
)
if
err
!=
nil
{
log
.
Panicf
(
"TempDir: %v"
,
err
)
}
server
,
err
:=
fs
.
Mount
(
mountPoint
,
node
,
opts
)
if
err
!=
nil
{
log
.
Panicf
(
"cannot mount %v"
,
err
)
...
...
@@ -53,8 +56,6 @@ func setupFs(node fs.InodeEmbedder, N int) (string, func()) {
err
:=
server
.
Unmount
()
if
err
!=
nil
{
log
.
Println
(
"error during unmount"
,
err
)
}
else
{
os
.
RemoveAll
(
mountPoint
)
}
}
}
...
...
@@ -251,8 +252,10 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
}
f
.
Close
()
mountPoint
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
mountPoint
,
err
:=
os
.
MkdirTemp
(
""
,
""
)
if
err
!=
nil
{
b
.
Fatalf
(
"MkdirTemp: %v"
,
err
)
}
cmd
:=
exec
.
Command
(
wd
+
"/cstatfs"
,
"-o"
,
...
...
fs/loopback_linux_test.go
View file @
8363cf88
...
...
@@ -301,7 +301,7 @@ func waitMount(mnt string) error {
func
TestParallelDiropsHang
(
t
*
testing
.
T
)
{
// We do NOT want to use newTestCase() here because we need to know the
// mnt path before the filesystem is mounted
dir
:=
t
estutil
.
TempDir
()
dir
:=
t
.
TempDir
()
orig
:=
dir
+
"/orig"
mnt
:=
dir
+
"/mnt"
if
err
:=
os
.
Mkdir
(
orig
,
0755
);
err
!=
nil
{
...
...
@@ -310,7 +310,6 @@ func TestParallelDiropsHang(t *testing.T) {
if
err
:=
os
.
Mkdir
(
mnt
,
0755
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
os
.
RemoveAll
(
dir
)
// Unblock the goroutines onces the mount shows up in /proc/self/mounts
wait
:=
make
(
chan
struct
{})
...
...
fs/mem_test.go
View file @
8363cf88
...
...
@@ -24,7 +24,7 @@ import (
func
testMount
(
t
*
testing
.
T
,
root
InodeEmbedder
,
opts
*
Options
)
(
string
,
*
fuse
.
Server
)
{
t
.
Helper
()
mntDir
:=
t
estutil
.
TempDir
()
mntDir
:=
t
.
TempDir
()
if
opts
==
nil
{
opts
=
&
Options
{
FirstAutomaticIno
:
1
,
...
...
@@ -40,9 +40,6 @@ func testMount(t *testing.T, root InodeEmbedder, opts *Options) (string, *fuse.S
if
err
:=
server
.
Unmount
();
err
!=
nil
{
t
.
Fatalf
(
"testMount: Unmount failed: %v"
,
err
)
}
if
err
:=
syscall
.
Rmdir
(
mntDir
);
err
!=
nil
{
t
.
Errorf
(
"testMount: Remove failed: %v"
,
err
)
}
})
return
mntDir
,
server
}
...
...
fs/simple_test.go
View file @
8363cf88
...
...
@@ -50,9 +50,6 @@ func (tc *testCase) clean() {
if
err
:=
tc
.
server
.
Unmount
();
err
!=
nil
{
tc
.
Fatal
(
err
)
}
if
err
:=
os
.
RemoveAll
(
tc
.
dir
);
err
!=
nil
{
tc
.
Fatal
(
err
)
}
}
type
testOptions
struct
{
...
...
@@ -73,7 +70,7 @@ func newTestCase(t *testing.T, opts *testOptions) *testCase {
opts
=
&
testOptions
{}
}
if
opts
.
testDir
==
""
{
opts
.
testDir
=
t
estutil
.
TempDir
()
opts
.
testDir
=
t
.
TempDir
()
}
tc
:=
&
testCase
{
dir
:
opts
.
testDir
,
...
...
@@ -356,8 +353,7 @@ func TestMknod(t *testing.T) {
}
func
TestMknodNotSupported
(
t
*
testing
.
T
)
{
mountPoint
:=
testutil
.
TempDir
()
defer
os
.
Remove
(
mountPoint
)
mountPoint
:=
t
.
TempDir
()
server
,
err
:=
Mount
(
mountPoint
,
&
Inode
{},
nil
)
if
err
!=
nil
{
...
...
fuse/pathfs/copy_test.go
View file @
8363cf88
...
...
@@ -6,17 +6,12 @@ package pathfs
import
(
"io/ioutil"
"os"
"testing"
"github.com/hanwen/go-fuse/v2/internal/testutil"
)
func
TestCopyFile
(
t
*
testing
.
T
)
{
d1
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
d1
)
d2
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
d2
)
d1
:=
t
.
TempDir
()
d2
:=
t
.
TempDir
()
fs1
:=
NewLoopbackFileSystem
(
d1
)
fs2
:=
NewLoopbackFileSystem
(
d2
)
...
...
fuse/pathfs/owner_test.go
View file @
8363cf88
...
...
@@ -35,7 +35,7 @@ func (fs *ownerFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse
}
func
setupOwnerTest
(
t
*
testing
.
T
,
opts
*
nodefs
.
Options
)
(
workdir
string
,
cleanup
func
())
{
wd
:=
t
estutil
.
TempDir
()
wd
:=
t
.
TempDir
()
opts
.
Debug
=
testutil
.
VerboseTest
()
fs
:=
&
ownerFs
{
NewDefaultFileSystem
()}
...
...
@@ -50,7 +50,6 @@ func setupOwnerTest(t *testing.T, opts *nodefs.Options) (workdir string, cleanup
}
return
wd
,
func
()
{
state
.
Unmount
()
os
.
RemoveAll
(
wd
)
}
}
...
...
fuse/pathfs/xattr_test.go
View file @
8363cf88
...
...
@@ -16,7 +16,6 @@ import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse/nodefs"
"github.com/hanwen/go-fuse/v2/internal/testutil"
)
var
xattrGolden
=
map
[
string
][]
byte
{
...
...
@@ -103,7 +102,7 @@ func (fs *XAttrTestFs) RemoveXAttr(name string, attr string, context *fuse.Conte
func
xattrTestCase
(
t
*
testing
.
T
,
nm
string
,
m
map
[
string
][]
byte
)
(
mountPoint
string
,
cleanup
func
())
{
xfs
:=
NewXAttrFs
(
nm
,
m
)
mountPoint
=
t
estutil
.
TempDir
()
mountPoint
=
t
.
TempDir
()
nfs
:=
NewPathNodeFs
(
xfs
,
nil
)
state
,
_
,
err
:=
nodefs
.
MountRoot
(
mountPoint
,
nfs
.
Root
(),
...
...
@@ -115,7 +114,6 @@ func xattrTestCase(t *testing.T, nm string, m map[string][]byte) (mountPoint str
go
state
.
Serve
()
return
mountPoint
,
func
()
{
state
.
Unmount
()
os
.
RemoveAll
(
mountPoint
)
}
}
...
...
fuse/test/cache_test.go
View file @
8363cf88
...
...
@@ -37,7 +37,7 @@ func (fs *cacheFs) Open(name string, flags uint32, context *fuse.Context) (fuseF
}
func
setupCacheTest
(
t
*
testing
.
T
)
(
string
,
*
pathfs
.
PathNodeFs
,
func
())
{
dir
:=
t
estutil
.
TempDir
()
dir
:=
t
.
TempDir
()
os
.
Mkdir
(
dir
+
"/mnt"
,
0755
)
os
.
Mkdir
(
dir
+
"/orig"
,
0755
)
...
...
@@ -65,10 +65,7 @@ func setupCacheTest(t *testing.T) (string, *pathfs.PathNodeFs, func()) {
t
.
Fatal
(
"WaitMount"
,
err
)
}
return
dir
,
pfs
,
func
()
{
err
:=
state
.
Unmount
()
if
err
==
nil
{
os
.
RemoveAll
(
dir
)
}
state
.
Unmount
()
}
}
...
...
@@ -186,8 +183,7 @@ func TestNonseekable(t *testing.T) {
fs
:=
&
nonseekFs
{
FileSystem
:
pathfs
.
NewDefaultFileSystem
()}
fs
.
Length
=
200
*
1024
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
nfs
:=
pathfs
.
NewPathNodeFs
(
fs
,
nil
)
opts
:=
nodefs
.
NewOptions
()
opts
.
Debug
=
testutil
.
VerboseTest
()
...
...
@@ -216,8 +212,7 @@ func TestNonseekable(t *testing.T) {
}
func
TestGetAttrRace
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
os
.
Mkdir
(
dir
+
"/mnt"
,
0755
)
os
.
Mkdir
(
dir
+
"/orig"
,
0755
)
...
...
fuse/test/cachecontrol_test.go
View file @
8363cf88
...
...
@@ -52,13 +52,7 @@ func (d *DataNode) Read(_ nodefs.File, dest []byte, off int64, _ *fuse.Context)
// TestCacheControl verifies that FUSE server process can store/retrieve kernel data cache.
func
TestCacheControl
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
func
()
{
err
:=
os
.
Remove
(
dir
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}()
dir
:=
t
.
TempDir
()
// setup a filesystem with 1 file
root
:=
nodefs
.
NewDefaultNode
()
...
...
fuse/test/defaultnode_test.go
View file @
8363cf88
...
...
@@ -16,8 +16,7 @@ import (
)
func
TestDefaultNodeGetAttr
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
opts
:=
&
nodefs
.
Options
{
// Note: defaultNode.GetAttr() calling file.GetAttr() is only useful if
...
...
fuse/test/defaultread_test.go
View file @
8363cf88
...
...
@@ -6,7 +6,6 @@ package test
import
(
"io/ioutil"
"os"
"testing"
"github.com/hanwen/go-fuse/v2/fuse"
...
...
@@ -42,7 +41,7 @@ func defaultReadTest(t *testing.T) (root string, cleanup func()) {
}
var
err
error
dir
:=
t
estutil
.
TempDir
()
dir
:=
t
.
TempDir
()
pathfs
:=
pathfs
.
NewPathNodeFs
(
fs
,
nil
)
opts
:=
nodefs
.
NewOptions
()
opts
.
Debug
=
testutil
.
VerboseTest
()
...
...
@@ -57,7 +56,6 @@ func defaultReadTest(t *testing.T) (root string, cleanup func()) {
}
return
dir
,
func
()
{
state
.
Unmount
()
os
.
Remove
(
dir
)
}
}
...
...
fuse/test/delete_linux_test.go
View file @
8363cf88
...
...
@@ -34,8 +34,7 @@ func (f *flipNode) GetAttr(out *fuse.Attr, file nodefs.File, c *fuse.Context) fu
}
func
TestDeleteNotify
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
root
:=
nodefs
.
NewMemNodeFSRoot
(
dir
+
"/backing"
)
conn
:=
nodefs
.
NewFileSystemConnector
(
root
,
&
nodefs
.
Options
{
PortableInodes
:
true
})
...
...
fuse/test/file_lock_test.go
View file @
8363cf88
...
...
@@ -123,8 +123,7 @@ func TestFlockInvoked(t *testing.T) {
t
.
Skip
(
"flock command not found."
)
}
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
opts
:=
&
nodefs
.
Options
{
Owner
:
fuse
.
CurrentOwner
(),
...
...
@@ -188,17 +187,8 @@ func TestNoLockSupport(t *testing.T) {
t
.
Skip
(
"flock command not found."
)
}
tmp
,
err
:=
ioutil
.
TempDir
(
""
,
"TestNoLockSupport"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
mnt
,
err
:=
ioutil
.
TempDir
(
""
,
"TestNoLockSupport"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
os
.
RemoveAll
(
tmp
)
defer
os
.
RemoveAll
(
mnt
)
tmp
:=
t
.
TempDir
()
mnt
:=
t
.
TempDir
()
opts
:=
&
nodefs
.
Options
{
Owner
:
fuse
.
CurrentOwner
(),
...
...
fuse/test/fsetattr_test.go
View file @
8363cf88
...
...
@@ -143,7 +143,7 @@ func NewFile() *MutableDataFile {
}
func
setupFAttrTest
(
t
*
testing
.
T
,
fs
pathfs
.
FileSystem
)
(
dir
string
,
clean
func
())
{
dir
=
t
estutil
.
TempDir
()
dir
=
t
.
TempDir
()
nfs
:=
pathfs
.
NewPathNodeFs
(
fs
,
nil
)
opts
:=
nodefs
.
NewOptions
()
opts
.
Debug
=
testutil
.
VerboseTest
()
...
...
@@ -161,8 +161,6 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func(
clean
=
func
()
{
if
err
:=
state
.
Unmount
();
err
!=
nil
{
t
.
Errorf
(
"cleanup: Unmount: %v"
,
err
)
}
else
{
os
.
RemoveAll
(
dir
)
}
}
...
...
fuse/test/loopback_linux_test.go
View file @
8363cf88
...
...
@@ -17,7 +17,6 @@ import (
"golang.org/x/sys/unix"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/internal/testutil"
)
var
enableOverlayfsTest
bool
...
...
@@ -147,11 +146,9 @@ func TestOverlayfs(t *testing.T) {
tc
.
Mkdir
(
tc
.
origSubdir
,
0777
)
tc
.
WriteFile
(
filepath
.
Join
(
tc
.
origSubdir
,
testfile
),
content
,
0700
)
tmpMergedDir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
tmpMergedDir
)
tmpWorkDir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
tmpWorkDir
)
tmpUpperDir
:=
testutil
.
TempDir
()
tmpMergedDir
:=
t
.
TempDir
()
tmpWorkDir
:=
t
.
TempDir
()
tmpUpperDir
:=
t
.
TempDir
()
defer
os
.
RemoveAll
(
tmpUpperDir
)
if
err
:=
unix
.
Mount
(
"overlay"
,
tmpMergedDir
,
"overlay"
,
0
,
fmt
.
Sprintf
(
"lowerdir=%s,upperdir=%s,workdir=%s"
,
tc
.
mnt
,
tmpUpperDir
,
tmpWorkDir
));
err
!=
nil
{
...
...
fuse/test/loopback_test.go
View file @
8363cf88
...
...
@@ -77,7 +77,7 @@ func NewTestCase(t *testing.T) *testCase {
const
subdir
string
=
"subdir"
var
err
error
tc
.
tmpDir
=
t
estutil
.
TempDir
()
tc
.
tmpDir
=
t
.
TempDir
()
tc
.
orig
=
tc
.
tmpDir
+
"/orig"
tc
.
mnt
=
tc
.
tmpDir
+
"/mnt"
...
...
@@ -125,7 +125,6 @@ func (tc *testCase) Cleanup() {
if
err
!=
nil
{
tc
.
tester
.
Fatalf
(
"Unmount failed: %v"
,
err
)
}
os
.
RemoveAll
(
tc
.
tmpDir
)
}
func
(
tc
*
testCase
)
rootNode
()
*
nodefs
.
Inode
{
...
...
@@ -774,8 +773,7 @@ func TestNonVerboseFStatFs(t *testing.T) {
}
func
TestOriginalIsSymlink
(
t
*
testing
.
T
)
{
tmpDir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
tmpDir
)
tmpDir
:=
t
.
TempDir
()
orig
:=
tmpDir
+
"/orig"
err
:=
os
.
Mkdir
(
orig
,
0755
)
if
err
!=
nil
{
...
...
fuse/test/mount_test.go
View file @
8363cf88
...
...
@@ -15,7 +15,6 @@ import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse/nodefs"
"github.com/hanwen/go-fuse/v2/fuse/pathfs"
"github.com/hanwen/go-fuse/v2/internal/testutil"
)
func
TestMountOnExisting
(
t
*
testing
.
T
)
{
...
...
@@ -171,8 +170,7 @@ func TestDeletedUnmount(t *testing.T) {
}
func
TestDefaultNodeMount
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
root
:=
nodefs
.
NewDefaultNode
()
s
,
conn
,
err
:=
nodefs
.
MountRoot
(
dir
,
root
,
nil
)
if
err
!=
nil
{
...
...
@@ -198,8 +196,7 @@ func TestDefaultNodeMount(t *testing.T) {
}
func
TestLiveness
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
root
:=
nodefs
.
NewDefaultNode
()
s
,
_
,
err
:=
nodefs
.
MountRoot
(
dir
,
root
,
nil
)
if
err
!=
nil
{
...
...
fuse/test/nil_file_truncation_test.go
View file @
8363cf88
...
...
@@ -28,13 +28,7 @@ func (d *truncatableFile) Truncate(file nodefs.File, size uint64, context *fuse.
// TestNilFileTruncation verifies that the FUSE server process does not
// crash when file truncation is performed on nil file handles.
func
TestNilFileTruncation
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
func
()
{
err
:=
os
.
Remove
(
dir
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}()
dir
:=
t
.
TempDir
()
root
:=
nodefs
.
NewDefaultNode
()
opts
:=
nodefs
.
NewOptions
()
...
...
fuse/test/node_parallel_lookup_test.go
View file @
8363cf88
...
...
@@ -11,7 +11,6 @@ import (
"fmt"
"io/ioutil"
"log"
"os"
"testing"
"golang.org/x/sync/errgroup"
...
...
@@ -58,13 +57,7 @@ func verifyFileRead(path string, dataOK string) error {
}
func
TestNodeParallelLookup
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
func
()
{
err
:=
os
.
Remove
(
dir
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}()
dir
:=
t
.
TempDir
()
root
:=
&
tRoot
{
Node
:
nodefs
.
NewDefaultNode
(),
...
...
fuse/test/node_test.go
View file @
8363cf88
...
...
@@ -61,7 +61,7 @@ func (n *rootNode) Lookup(out *fuse.Attr, name string, context *fuse.Context) (*
}
func
TestUpdateNode
(
t
*
testing
.
T
)
{
dir
:=
t
estutil
.
TempDir
()
dir
:=
t
.
TempDir
()
root
:=
&
rootNode
{
Node
:
nodefs
.
NewDefaultNode
(),
backing
:
map
[
string
]
string
{
"a"
:
"aaa"
},
...
...
fuse/test/nofile_test.go
View file @
8363cf88
...
...
@@ -6,7 +6,6 @@ package test
import
(
"io/ioutil"
"os"
"sync/atomic"
"testing"
...
...
@@ -51,13 +50,7 @@ func (d *NoFileNode) Open(flags uint32, context *fuse.Context) (nodefs.File, fus
}
func
TestNoFile
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
func
()
{
err
:=
os
.
Remove
(
dir
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}()
dir
:=
t
.
TempDir
()
// setup a filesystem with 2 files:
//
...
...
fuse/test/notify_linux_test.go
View file @
8363cf88
...
...
@@ -78,7 +78,7 @@ type NotifyTest struct {
func
NewNotifyTest
(
t
*
testing
.
T
)
*
NotifyTest
{
me
:=
&
NotifyTest
{}
me
.
fs
=
newNotifyFs
()
me
.
dir
=
t
estutil
.
TempDir
()
me
.
dir
=
t
.
TempDir
()
entryTTL
:=
100
*
time
.
Millisecond
opts
:=
&
nodefs
.
Options
{
EntryTimeout
:
entryTTL
,
...
...
fuse/test/umask_test.go
View file @
8363cf88
...
...
@@ -34,7 +34,7 @@ func (fs *umaskFS) Mkdir(name string, mode uint32, context *fuse.Context) (code
}
func
TestUmask
(
t
*
testing
.
T
)
{
tmpDir
:=
t
estutil
.
TempDir
()
tmpDir
:=
t
.
TempDir
()
orig
:=
tmpDir
+
"/orig"
mnt
:=
tmpDir
+
"/mnt"
...
...
fuse/test/xattr_test.go
View file @
8363cf88
...
...
@@ -8,7 +8,6 @@
package
test
import
(
"os"
"path/filepath"
"syscall"
"testing"
...
...
@@ -40,8 +39,7 @@ func (n *xattrChildNode) GetXAttr(attr string, context *fuse.Context) ([]byte, f
}
func
TestDefaultXAttr
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
root
:=
&
xattrNode
{
Node
:
nodefs
.
NewDefaultNode
(),
...
...
@@ -70,8 +68,7 @@ func TestDefaultXAttr(t *testing.T) {
}
func
TestEmptyXAttr
(
t
*
testing
.
T
)
{
dir
:=
testutil
.
TempDir
()
defer
os
.
RemoveAll
(
dir
)
dir
:=
t
.
TempDir
()
root
:=
&
xattrNode
{
Node
:
nodefs
.
NewDefaultNode
(),
...
...
internal/testutil/tempdir.go
deleted
100644 → 0
View file @
bd47fe9b
// Copyright 2016 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
testutil
import
(
"io/ioutil"
"log"
"runtime"
"strings"
)
// TempDir creates a temporary directory that includes the name of the
// testcase. Panics if there was an I/O problem creating the directory.
func
TempDir
()
string
{
frames
:=
make
([]
uintptr
,
10
)
// at least 1 entry needed
n
:=
runtime
.
Callers
(
1
,
frames
)
lastName
:=
""
for
_
,
pc
:=
range
frames
[
:
n
]
{
f
:=
runtime
.
FuncForPC
(
pc
)
name
:=
f
.
Name
()
i
:=
strings
.
LastIndex
(
name
,
"."
)
if
i
>=
0
{
name
=
name
[
i
+
1
:
]
}
if
strings
.
HasPrefix
(
name
,
"Test"
)
{
lastName
=
name
}
}
dir
,
err
:=
ioutil
.
TempDir
(
""
,
lastName
)
if
err
!=
nil
{
log
.
Panicf
(
"TempDir(%s): %v"
,
lastName
,
err
)
}
return
dir
}
newunionfs/unionfs_test.go
View file @
8363cf88
...
...
@@ -33,12 +33,11 @@ func (tc *testCase) Clean() {
tc
.
server
.
Unmount
()
tc
.
server
=
nil
}
os
.
RemoveAll
(
tc
.
dir
)
}
func
newTestCase
(
t
*
testing
.
T
,
populate
bool
)
*
testCase
{
t
.
Helper
()
dir
:=
t
estutil
.
TempDir
()
dir
:=
t
.
TempDir
()
dirs
:=
[]
string
{
"ro"
,
"rw"
,
"mnt"
}
if
populate
{
dirs
=
append
(
dirs
,
"ro/dir"
)
...
...
zipfs/multizip_test.go
View file @
8363cf88
...
...
@@ -19,7 +19,7 @@ const testTtl = 100 * time.Millisecond
func
setupMzfs
(
t
*
testing
.
T
)
(
mountPoint
string
,
state
*
fuse
.
Server
,
cleanup
func
())
{
root
:=
&
MultiZipFs
{}
mountPoint
=
t
estutil
.
TempDir
()
mountPoint
=
t
.
TempDir
()
dt
:=
testTtl
opts
:=
&
fs
.
Options
{
...
...
@@ -34,7 +34,6 @@ func setupMzfs(t *testing.T) (mountPoint string, state *fuse.Server, cleanup fun
}
return
mountPoint
,
server
,
func
()
{
server
.
Unmount
()
os
.
RemoveAll
(
mountPoint
)
}
}
...
...
zipfs/tarfs_test.go
View file @
8363cf88
...
...
@@ -67,8 +67,7 @@ func TestTar(t *testing.T) {
root
:=
&
tarRoot
{
rc
:
&
addClose
{
buf
}}
mnt
:=
testutil
.
TempDir
()
defer
os
.
Remove
(
mnt
)
mnt
:=
t
.
TempDir
()
opts
:=
&
fs
.
Options
{}
opts
.
Debug
=
testutil
.
VerboseTest
()
s
,
err
:=
fs
.
Mount
(
mnt
,
root
,
opts
)
...
...
zipfs/zipfs_test.go
View file @
8363cf88
...
...
@@ -33,14 +33,13 @@ func setupZipfs(t *testing.T) (mountPoint string, cleanup func()) {
t
.
Fatalf
(
"NewArchiveFileSystem failed: %v"
,
err
)
}
mountPoint
=
t
estutil
.
TempDir
()
mountPoint
=
t
.
TempDir
()
opts
:=
&
fs
.
Options
{}
opts
.
Debug
=
testutil
.
VerboseTest
()
server
,
err
:=
fs
.
Mount
(
mountPoint
,
root
,
opts
)
return
mountPoint
,
func
()
{
server
.
Unmount
()
os
.
RemoveAll
(
mountPoint
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment