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
135f7059
Commit
135f7059
authored
Apr 28, 2024
by
lch
Committed by
lchopn
Apr 30, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs: fix building of tests
Change-Id: Iffa5314fbe171d182a4bdef42e0ab4781cc1d221
parent
8d89f3cd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
12 deletions
+17
-12
fs/dir_test.go
fs/dir_test.go
+9
-4
fs/maxwrite_test.go
fs/maxwrite_test.go
+1
-1
fs/mem_test.go
fs/mem_test.go
+1
-2
fs/readonly_test.go
fs/readonly_test.go
+3
-3
fs/simple_test.go
fs/simple_test.go
+3
-2
No files found.
fs/dir_test.go
View file @
135f7059
...
@@ -45,7 +45,7 @@ func (ds *errDirStream) Next() (fuse.DirEntry, syscall.Errno) {
...
@@ -45,7 +45,7 @@ func (ds *errDirStream) Next() (fuse.DirEntry, syscall.Errno) {
Mode
:
fuse
.
S_IFREG
,
Mode
:
fuse
.
S_IFREG
,
Name
:
"last"
,
Name
:
"last"
,
Ino
:
3
,
Ino
:
3
,
},
syscall
.
E
KEYEXPIRED
},
syscall
.
E
BADMSG
}
}
panic
(
"boom"
)
panic
(
"boom"
)
...
@@ -76,9 +76,14 @@ func TestDirStreamError(t *testing.T) {
...
@@ -76,9 +76,14 @@ func TestDirStreamError(t *testing.T) {
}
else
if
e
.
Name
!=
"first"
{
}
else
if
e
.
Name
!=
"first"
{
t
.
Errorf
(
"got %q want 'first'"
,
e
.
Name
)
t
.
Errorf
(
"got %q want 'first'"
,
e
.
Name
)
}
}
// Here we need choose a errno to test if errno could be passed and handled
if
_
,
errno
:=
ds
.
Next
();
errno
!=
syscall
.
EKEYEXPIRED
{
// correctly by the fuse library. To build the test on different platform,
t
.
Errorf
(
"got errno %v, want EKEYEXPIRED"
,
errno
)
// an errno which defined on each platform should be chosen. And if the
// chosen integer number is not a valid errno, the fuse in kernel would refuse
// and throw an error, which is observed on Linux.
// Here we choose to use EBADMSG, which is defined on multiple Unix-like OSes.
if
_
,
errno
:=
ds
.
Next
();
errno
!=
syscall
.
EBADMSG
{
t
.
Errorf
(
"got errno %v, want EBADMSG"
,
errno
)
}
}
})
})
}
}
...
...
fs/maxwrite_test.go
View file @
135f7059
...
@@ -244,7 +244,7 @@ func bdiReadahead(mnt string) int {
...
@@ -244,7 +244,7 @@ func bdiReadahead(mnt string) int {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
path
:=
fmt
.
Sprintf
(
"/sys/class/bdi/%d:%d/read_ahead_kb"
,
unix
.
Major
(
st
.
Dev
),
unix
.
Minor
(
st
.
Dev
))
path
:=
fmt
.
Sprintf
(
"/sys/class/bdi/%d:%d/read_ahead_kb"
,
unix
.
Major
(
uint64
(
st
.
Dev
)),
unix
.
Minor
(
uint64
(
st
.
Dev
)
))
buf
,
err
:=
ioutil
.
ReadFile
(
path
)
buf
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
...
fs/mem_test.go
View file @
135f7059
...
@@ -137,8 +137,7 @@ func TestDataFile(t *testing.T) {
...
@@ -137,8 +137,7 @@ func TestDataFile(t *testing.T) {
if
err
:=
syscall
.
Lstat
(
mntDir
+
"/file"
,
&
st
);
err
!=
nil
{
if
err
:=
syscall
.
Lstat
(
mntDir
+
"/file"
,
&
st
);
err
!=
nil
{
t
.
Fatalf
(
"Lstat: %v"
,
err
)
t
.
Fatalf
(
"Lstat: %v"
,
err
)
}
}
if
want
:=
uint
(
syscall
.
S_IFREG
|
0464
);
uint
(
st
.
Mode
)
!=
want
{
if
want
:=
uint32
(
syscall
.
S_IFREG
|
0464
);
st
.
Mode
!=
want
{
t
.
Errorf
(
"got mode %o, want %o"
,
st
.
Mode
,
want
)
t
.
Errorf
(
"got mode %o, want %o"
,
st
.
Mode
,
want
)
}
}
...
...
fs/readonly_test.go
View file @
135f7059
...
@@ -11,14 +11,14 @@ import (
...
@@ -11,14 +11,14 @@ import (
"testing"
"testing"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse"
"golang.org/x/sys/unix"
)
)
func
TestReadonlyCreate
(
t
*
testing
.
T
)
{
func
TestReadonlyCreate
(
t
*
testing
.
T
)
{
root
:=
&
Inode
{}
root
:=
&
Inode
{}
mntDir
,
_
:=
testMount
(
t
,
root
,
nil
)
mntDir
,
_
:=
testMount
(
t
,
root
,
nil
)
_
,
err
:=
unix
.
Open
(
mntDir
+
"/test"
,
unix
.
O_CREAT
,
0644
)
_
,
err
:=
syscall
.
Creat
(
mntDir
+
"/test"
,
0644
)
if
want
:=
syscall
.
EROFS
;
want
!=
err
{
if
want
:=
syscall
.
EROFS
;
want
!=
err
{
t
.
Fatalf
(
"got err %v, want %v"
,
err
,
want
)
t
.
Fatalf
(
"got err %v, want %v"
,
err
,
want
)
}
}
...
@@ -44,7 +44,7 @@ func TestDefaultPermissions(t *testing.T) {
...
@@ -44,7 +44,7 @@ func TestDefaultPermissions(t *testing.T) {
var
st
syscall
.
Stat_t
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Lstat
(
filepath
.
Join
(
mntDir
,
k
),
&
st
);
err
!=
nil
{
if
err
:=
syscall
.
Lstat
(
filepath
.
Join
(
mntDir
,
k
),
&
st
);
err
!=
nil
{
t
.
Error
(
"Lstat"
,
err
)
t
.
Error
(
"Lstat"
,
err
)
}
else
if
st
.
Mode
!=
v
{
}
else
if
uint
(
st
.
Mode
)
!=
uint
(
v
)
{
t
.
Errorf
(
"got %o want %o"
,
st
.
Mode
,
v
)
t
.
Errorf
(
"got %o want %o"
,
st
.
Mode
,
v
)
}
}
}
}
...
...
fs/simple_test.go
View file @
135f7059
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/internal/testutil"
"github.com/hanwen/go-fuse/v2/internal/testutil"
"github.com/hanwen/go-fuse/v2/posixtest"
"github.com/hanwen/go-fuse/v2/posixtest"
"golang.org/x/sys/unix"
)
)
type
testCase
struct
{
type
testCase
struct
{
...
@@ -339,7 +340,7 @@ func TestMknod(t *testing.T) {
...
@@ -339,7 +340,7 @@ func TestMknod(t *testing.T) {
var
st
syscall
.
Stat_t
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Stat
(
p
,
&
st
);
err
!=
nil
{
if
err
:=
syscall
.
Stat
(
p
,
&
st
);
err
!=
nil
{
got
:=
st
.
Mode
&^
07777
got
:=
st
.
Mode
&^
07777
if
want
:=
mode
;
got
!=
want
{
if
want
:=
uint
(
mode
);
want
!=
uint
(
got
)
{
t
.
Fatalf
(
"stat(%s): got %o want %o"
,
nm
,
got
,
want
)
t
.
Fatalf
(
"stat(%s): got %o want %o"
,
nm
,
got
,
want
)
}
}
}
}
...
@@ -648,7 +649,7 @@ func TestStaleHardlinks(t *testing.T) {
...
@@ -648,7 +649,7 @@ func TestStaleHardlinks(t *testing.T) {
// "link0" is original file
// "link0" is original file
link0
:=
tc
.
mntDir
+
"/link0"
link0
:=
tc
.
mntDir
+
"/link0"
if
fd
,
err
:=
syscall
.
Creat
(
link0
,
0600
);
err
!=
nil
{
if
fd
,
err
:=
unix
.
Open
(
link0
,
unix
.
O_CREAT
,
0600
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
else
{
}
else
{
syscall
.
Close
(
fd
)
syscall
.
Close
(
fd
)
...
...
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