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
4f40cf4c
Commit
4f40cf4c
authored
Apr 06, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
newunionfs: run PosixTest tests.
parent
343e78c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
10 deletions
+42
-10
newunionfs/unionfs_test.go
newunionfs/unionfs_test.go
+42
-10
No files found.
newunionfs/unionfs_test.go
View file @
4f40cf4c
...
...
@@ -15,6 +15,7 @@ import (
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/internal/testutil"
"github.com/hanwen/go-fuse/nodefs"
"github.com/hanwen/go-fuse/posixtest"
)
type
testCase
struct
{
...
...
@@ -34,11 +35,15 @@ func (tc *testCase) Clean() {
os
.
RemoveAll
(
tc
.
dir
)
}
func
newTestCase
(
t
*
testing
.
T
)
*
testCase
{
func
newTestCase
(
t
*
testing
.
T
,
populate
bool
)
*
testCase
{
t
.
Helper
()
dir
:=
testutil
.
TempDir
()
dirs
:=
[]
string
{
"ro"
,
"rw"
,
"mnt"
}
if
populate
{
dirs
=
append
(
dirs
,
"ro/dir"
)
}
for
_
,
d
:=
range
[]
string
{
"ro"
,
"rw"
,
"mnt"
,
"ro/dir"
}
{
for
_
,
d
:=
range
dirs
{
if
err
:=
os
.
Mkdir
(
filepath
.
Join
(
dir
,
d
),
0755
);
err
!=
nil
{
t
.
Fatal
(
"Mkdir"
,
err
)
}
...
...
@@ -63,15 +68,17 @@ func newTestCase(t *testing.T) *testCase {
tc
.
server
=
server
if
populate
{
if
err
:=
ioutil
.
WriteFile
(
tc
.
ro
+
"/dir/ro-file"
,
[]
byte
(
"bla"
),
0644
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
return
tc
}
func
TestBasic
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
)
tc
:=
newTestCase
(
t
,
true
)
defer
tc
.
Clean
()
if
fi
,
err
:=
os
.
Lstat
(
tc
.
mnt
+
"/dir/ro-file"
);
err
!=
nil
{
...
...
@@ -82,7 +89,7 @@ func TestBasic(t *testing.T) {
}
func
TestDelete
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
)
tc
:=
newTestCase
(
t
,
true
)
defer
tc
.
Clean
()
if
err
:=
os
.
Remove
(
tc
.
mnt
+
"/dir/ro-file"
);
err
!=
nil
{
...
...
@@ -104,7 +111,7 @@ func TestDelete(t *testing.T) {
}
func
TestDeleteMarker
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
)
tc
:=
newTestCase
(
t
,
true
)
defer
tc
.
Clean
()
path
:=
"dir/ro-file"
...
...
@@ -125,7 +132,7 @@ func TestDeleteMarker(t *testing.T) {
}
func
TestCreate
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
)
tc
:=
newTestCase
(
t
,
true
)
defer
tc
.
Clean
()
path
:=
"dir/ro-file"
...
...
@@ -146,7 +153,7 @@ func TestCreate(t *testing.T) {
}
func
TestPromote
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
)
tc
:=
newTestCase
(
t
,
true
)
defer
tc
.
Clean
()
path
:=
"dir/ro-file"
...
...
@@ -165,7 +172,7 @@ func TestPromote(t *testing.T) {
}
func
TestDeleteRevert
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
)
tc
:=
newTestCase
(
t
,
true
)
defer
tc
.
Clean
()
path
:=
"dir/ro-file"
...
...
@@ -188,3 +195,28 @@ func TestDeleteRevert(t *testing.T) {
t
.
Fatalf
(
"Lstat after: got %v, want ENOENT"
,
err
)
}
}
func
TestPosix
(
t
*
testing
.
T
)
{
cases
:=
[]
string
{
"SymlinkReadlink"
,
"FileBasic"
,
"TruncateFile"
,
"TruncateNoFile"
,
"FdLeak"
,
// "MkdirRmdir",
// "NlinkZero",
"ParallelFileOpen"
,
// "Link",
// "ReadDir",
}
for
_
,
nm
:=
range
cases
{
f
:=
posixtest
.
All
[
nm
]
t
.
Run
(
nm
,
func
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
,
false
)
defer
tc
.
Clean
()
f
(
t
,
tc
.
mnt
)
})
}
}
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