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
9907e270
Commit
9907e270
authored
Jun 30, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split up loopback_test.go testcases.
parent
015cd0f4
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
169 deletions
+135
-169
fuse/loopback_test.go
fuse/loopback_test.go
+118
-146
fuse/mount_test.go
fuse/mount_test.go
+17
-23
No files found.
fuse/loopback_test.go
View file @
9907e270
This diff is collapsed.
Click to expand it.
fuse/mount_test.go
View file @
9907e270
...
...
@@ -10,11 +10,10 @@ import (
)
func
TestMountOnExisting
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
err
:=
os
.
Mkdir
(
ts
.
m
ountPoi
nt
+
"/mnt"
,
0777
)
err
:=
os
.
Mkdir
(
ts
.
mnt
+
"/mnt"
,
0777
)
CheckSuccess
(
err
)
fs
:=
&
DefaultFileSystem
{}
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
...
...
@@ -22,7 +21,7 @@ func TestMountOnExisting(t *testing.T) {
t
.
Fatal
(
"expect EBUSY:"
,
code
)
}
err
=
os
.
Remove
(
ts
.
m
ountPoi
nt
+
"/mnt"
)
err
=
os
.
Remove
(
ts
.
mnt
+
"/mnt"
)
CheckSuccess
(
err
)
code
=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
...
...
@@ -31,8 +30,7 @@ func TestMountOnExisting(t *testing.T) {
}
func
TestUnmountNoExist
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
code
:=
ts
.
connector
.
Unmount
(
"/doesnotexist"
)
...
...
@@ -42,33 +40,31 @@ func TestUnmountNoExist(t *testing.T) {
}
func
TestMountRename
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
fs
:=
NewLoopbackFileSystem
(
ts
.
orig
Dir
)
fs
:=
NewLoopbackFileSystem
(
ts
.
orig
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"mount should succeed"
)
}
err
:=
os
.
Rename
(
ts
.
m
ountPoint
+
"/mnt"
,
ts
.
mountPoi
nt
+
"/foobar"
)
err
:=
os
.
Rename
(
ts
.
m
nt
+
"/mnt"
,
ts
.
m
nt
+
"/foobar"
)
if
OsErrorToErrno
(
err
)
!=
EBUSY
{
t
.
Fatal
(
"rename mount point should fail with EBUSY:"
,
err
)
}
}
func
TestMountReaddir
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
fs
:=
NewLoopbackFileSystem
(
ts
.
orig
Dir
)
fs
:=
NewLoopbackFileSystem
(
ts
.
orig
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"mount should succeed"
)
}
entries
,
err
:=
ioutil
.
ReadDir
(
ts
.
m
ountPoi
nt
)
entries
,
err
:=
ioutil
.
ReadDir
(
ts
.
mnt
)
CheckSuccess
(
err
)
if
len
(
entries
)
!=
1
||
entries
[
0
]
.
Name
!=
"mnt"
{
t
.
Error
(
"wrong readdir result"
,
entries
)
...
...
@@ -76,20 +72,19 @@ func TestMountReaddir(t *testing.T) {
}
func
TestRecursiveMount
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
err
:=
ioutil
.
WriteFile
(
ts
.
orig
Dir
+
"/hello.txt"
,
[]
byte
(
"blabla"
),
0644
)
err
:=
ioutil
.
WriteFile
(
ts
.
orig
+
"/hello.txt"
,
[]
byte
(
"blabla"
),
0644
)
CheckSuccess
(
err
)
fs
:=
NewLoopbackFileSystem
(
ts
.
orig
Dir
)
fs
:=
NewLoopbackFileSystem
(
ts
.
orig
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"mount should succeed"
)
}
submnt
:=
ts
.
m
ountPoi
nt
+
"/mnt"
submnt
:=
ts
.
mnt
+
"/mnt"
_
,
err
=
os
.
Lstat
(
submnt
)
CheckSuccess
(
err
)
_
,
err
=
os
.
Lstat
(
filepath
.
Join
(
submnt
,
"hello.txt"
))
...
...
@@ -116,12 +111,11 @@ func TestRecursiveMount(t *testing.T) {
}
func
TestDeletedUnmount
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
submnt
:=
filepath
.
Join
(
ts
.
m
ountPoi
nt
,
"mnt"
)
pfs2
:=
NewLoopbackFileSystem
(
ts
.
orig
Dir
)
submnt
:=
filepath
.
Join
(
ts
.
mnt
,
"mnt"
)
pfs2
:=
NewLoopbackFileSystem
(
ts
.
orig
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
pfs2
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"Mount error"
,
code
)
...
...
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