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
Levin Zimmermann
go-fuse
Commits
45317e97
Commit
45317e97
authored
May 08, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup temp directories after use.
parent
3b479a8f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
45 deletions
+58
-45
fuse/fsetattr_test.go
fuse/fsetattr_test.go
+1
-0
fuse/fuse.go
fuse/fuse.go
+4
-0
fuse/pathdebug_test.go
fuse/pathdebug_test.go
+1
-0
fuse/xattr_test.go
fuse/xattr_test.go
+1
-0
unionfs/autounion_test.go
unionfs/autounion_test.go
+11
-8
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+34
-31
zipfs/multizip_test.go
zipfs/multizip_test.go
+2
-2
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+4
-4
No files found.
fuse/fsetattr_test.go
View file @
45317e97
...
...
@@ -131,6 +131,7 @@ func TestFSetAttr(t *testing.T) {
state
.
Mount
(
dir
)
state
.
Debug
=
true
defer
state
.
Unmount
()
defer
os
.
RemoveAll
(
dir
)
go
state
.
Loop
(
false
)
...
...
fuse/fuse.go
View file @
45317e97
...
...
@@ -40,6 +40,10 @@ func (me *MountState) KernelSettings() InitIn {
return
me
.
kernelSettings
}
func
(
me
*
MountState
)
MountPoint
()
string
{
return
me
.
mountPoint
}
// Mount filesystem on mountPoint.
func
(
me
*
MountState
)
Mount
(
mountPoint
string
)
os
.
Error
{
file
,
mp
,
err
:=
mount
(
mountPoint
)
...
...
fuse/pathdebug_test.go
View file @
45317e97
...
...
@@ -14,6 +14,7 @@ func TestPathDebug(t *testing.T) {
connector
:=
NewFileSystemConnector
(
debugFs
,
nil
)
mountPoint
:=
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
state
:=
NewMountState
(
connector
)
state
.
Mount
(
mountPoint
)
...
...
fuse/xattr_test.go
View file @
45317e97
...
...
@@ -95,6 +95,7 @@ func TestXAttrRead(t *testing.T) {
connector
:=
NewFileSystemConnector
(
xfs
,
nil
)
mountPoint
:=
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
state
:=
NewMountState
(
connector
)
state
.
Mount
(
mountPoint
)
...
...
unionfs/autounion_test.go
View file @
45317e97
...
...
@@ -30,7 +30,7 @@ func WriteFile(name string, contents string) {
CheckSuccess
(
err
)
}
func
setup
(
t
*
testing
.
T
)
(
workdir
string
,
state
*
fuse
.
MountState
)
{
func
setup
(
t
*
testing
.
T
)
(
workdir
string
,
cleanup
func
()
)
{
wd
:=
fuse
.
MakeTempDir
()
err
:=
os
.
Mkdir
(
wd
+
"/mount"
,
0700
)
fuse
.
CheckSuccess
(
err
)
...
...
@@ -45,18 +45,21 @@ func setup(t *testing.T) (workdir string, state *fuse.MountState) {
fs
:=
NewAutoUnionFs
(
wd
+
"/store"
,
testAOpts
)
connector
:=
fuse
.
NewFileSystemConnector
(
fs
,
&
testAOpts
.
MountOptions
)
state
=
fuse
.
NewMountState
(
connector
)
state
:
=
fuse
.
NewMountState
(
connector
)
state
.
Mount
(
wd
+
"/mount"
)
state
.
Debug
=
true
go
state
.
Loop
(
false
)
return
wd
,
state
return
wd
,
func
()
{
state
.
Unmount
()
os
.
RemoveAll
(
wd
)
}
}
func
TestAutoFsSymlink
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setup
(
t
)
defer
clean
()
err
:=
os
.
Mkdir
(
wd
+
"/store/foo"
,
0755
)
CheckSuccess
(
err
)
os
.
Symlink
(
wd
+
"/ro"
,
wd
+
"/store/foo/READONLY"
)
...
...
@@ -88,8 +91,8 @@ func TestAutoFsSymlink(t *testing.T) {
}
func
TestCreationChecks
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setup
(
t
)
defer
clean
()
err
:=
os
.
Mkdir
(
wd
+
"/store/foo"
,
0755
)
CheckSuccess
(
err
)
...
...
unionfs/unionfs_test.go
View file @
45317e97
...
...
@@ -26,7 +26,7 @@ var testOpts = UnionFsOptions{
BranchCacheTTLSecs
:
entryTtl
,
}
func
setupUfs
(
t
*
testing
.
T
)
(
workdir
string
,
state
*
fuse
.
MountState
)
{
func
setupUfs
(
t
*
testing
.
T
)
(
workdir
string
,
cleanup
func
()
)
{
wd
:=
fuse
.
MakeTempDir
()
err
:=
os
.
Mkdir
(
wd
+
"/mount"
,
0700
)
fuse
.
CheckSuccess
(
err
)
...
...
@@ -49,12 +49,15 @@ func setupUfs(t *testing.T) (workdir string, state *fuse.MountState) {
}
connector
:=
fuse
.
NewFileSystemConnector
(
ufs
,
opts
)
state
=
fuse
.
NewMountState
(
connector
)
state
:
=
fuse
.
NewMountState
(
connector
)
state
.
Mount
(
wd
+
"/mount"
)
state
.
Debug
=
true
go
state
.
Loop
(
false
)
return
wd
,
state
return
wd
,
func
()
{
state
.
Unmount
()
os
.
RemoveAll
(
wd
)
}
}
func
writeToFile
(
path
string
,
contents
string
)
{
...
...
@@ -118,8 +121,8 @@ func remove(path string) {
}
func
TestSymlink
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
Symlink
(
"/foobar"
,
wd
+
"/mount/link"
)
CheckSuccess
(
err
)
...
...
@@ -133,8 +136,8 @@ func TestSymlink(t *testing.T) {
}
func
TestChtimes
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
writeToFile
(
wd
+
"/ro/file"
,
"a"
)
err
:=
os
.
Chtimes
(
wd
+
"/ro/file"
,
42e9
,
43e9
)
...
...
@@ -150,8 +153,8 @@ func TestChtimes(t *testing.T) {
}
func
TestChmod
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
ro_fn
:=
wd
+
"/ro/file"
m_fn
:=
wd
+
"/mount/file"
...
...
@@ -177,8 +180,8 @@ func TestChmod(t *testing.T) {
}
func
TestBasic
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
writeToFile
(
wd
+
"/rw/rw"
,
"a"
)
writeToFile
(
wd
+
"/ro/ro1"
,
"a"
)
...
...
@@ -240,8 +243,8 @@ func TestBasic(t *testing.T) {
}
func
TestPromote
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
Mkdir
(
wd
+
"/ro/subdir"
,
0755
)
CheckSuccess
(
err
)
...
...
@@ -250,8 +253,8 @@ func TestPromote(t *testing.T) {
}
func
TestCreate
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
MkdirAll
(
wd
+
"/ro/subdir/sub2"
,
0755
)
CheckSuccess
(
err
)
...
...
@@ -261,8 +264,8 @@ func TestCreate(t *testing.T) {
}
func
TestOpenUndeletes
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
writeToFile
(
wd
+
"/ro/file"
,
"X"
)
err
:=
os
.
Remove
(
wd
+
"/mount/file"
)
...
...
@@ -273,8 +276,8 @@ func TestOpenUndeletes(t *testing.T) {
}
func
TestMkdir
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
dirname
:=
wd
+
"/mount/subdir"
err
:=
os
.
Mkdir
(
dirname
,
0755
)
...
...
@@ -285,8 +288,8 @@ func TestMkdir(t *testing.T) {
}
func
TestMkdirPromote
(
t
*
testing
.
T
)
{
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
dirname
:=
wd
+
"/ro/subdir/subdir2"
err
:=
os
.
MkdirAll
(
dirname
,
0755
)
...
...
@@ -320,7 +323,7 @@ func TestRename(t *testing.T) {
for
i
,
c
:=
range
configs
{
t
.
Log
(
"Config"
,
i
,
c
)
wd
,
state
:=
setupUfs
(
t
)
wd
,
clean
:=
setupUfs
(
t
)
if
c
.
f1_ro
{
writeToFile
(
wd
+
"/ro/file1"
,
"c1"
)
}
...
...
@@ -354,14 +357,14 @@ func TestRename(t *testing.T) {
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file1"
)
CheckSuccess
(
err
)
state
.
Unmount
()
clean
()
}
}
func
TestWritableDir
(
t
*
testing
.
T
)
{
t
.
Log
(
"TestWritableDir"
)
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
dirname
:=
wd
+
"/ro/subdir"
err
:=
os
.
Mkdir
(
dirname
,
0555
)
...
...
@@ -376,8 +379,8 @@ func TestWritableDir(t *testing.T) {
func
TestTruncate
(
t
*
testing
.
T
)
{
t
.
Log
(
"TestTruncate"
)
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
writeToFile
(
wd
+
"/ro/file"
,
"hello"
)
os
.
Truncate
(
wd
+
"/mount/file"
,
2
)
...
...
@@ -393,8 +396,8 @@ func TestTruncate(t *testing.T) {
func
TestCopyChmod
(
t
*
testing
.
T
)
{
t
.
Log
(
"TestCopyChmod"
)
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
contents
:=
"hello"
fn
:=
wd
+
"/mount/y"
...
...
@@ -426,8 +429,8 @@ func abs(dt int64) int64 {
func
TestTruncateTimestamp
(
t
*
testing
.
T
)
{
t
.
Log
(
"TestTruncateTimestamp"
)
wd
,
state
:=
setupUfs
(
t
)
defer
state
.
Unmount
()
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
contents
:=
"hello"
fn
:=
wd
+
"/mount/y"
...
...
zipfs/multizip_test.go
View file @
45317e97
...
...
@@ -24,9 +24,11 @@ func TestMultiZipFs(t *testing.T) {
fs
:=
NewMultiZipFs
()
state
:=
fuse
.
NewMountState
(
fs
.
Connector
)
mountPoint
:=
fuse
.
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
state
.
Debug
=
true
err
=
state
.
Mount
(
mountPoint
)
defer
state
.
Unmount
()
CheckSuccess
(
err
)
go
state
.
Loop
(
true
)
...
...
@@ -97,6 +99,4 @@ func TestMultiZipFs(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"stat should fail after unmount."
,
fi
)
}
state
.
Unmount
()
}
zipfs/zipfs_test.go
View file @
45317e97
...
...
@@ -16,10 +16,12 @@ func TestZipFs(t *testing.T) {
connector
:=
fuse
.
NewFileSystemConnector
(
zfs
,
nil
)
mountPoint
:=
fuse
.
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
state
:=
fuse
.
NewMountState
(
connector
)
state
.
Mount
(
mountPoint
)
defer
state
.
Unmount
()
go
state
.
Loop
(
false
)
d
,
err
:=
os
.
Open
(
mountPoint
)
...
...
@@ -57,6 +59,4 @@ func TestZipFs(t *testing.T) {
t
.
Error
(
"content fail"
,
b
[
:
n
])
}
f
.
Close
()
state
.
Unmount
()
}
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