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) {
Mode
:
fuse
.
S_IFREG
,
Name
:
"last"
,
Ino
:
3
,
},
syscall
.
E
KEYEXPIRED
},
syscall
.
E
BADMSG
}
panic
(
"boom"
)
...
...
@@ -76,9 +76,14 @@ func TestDirStreamError(t *testing.T) {
}
else
if
e
.
Name
!=
"first"
{
t
.
Errorf
(
"got %q want 'first'"
,
e
.
Name
)
}
if
_
,
errno
:=
ds
.
Next
();
errno
!=
syscall
.
EKEYEXPIRED
{
t
.
Errorf
(
"got errno %v, want EKEYEXPIRED"
,
errno
)
// Here we need choose a errno to test if errno could be passed and handled
// correctly by the fuse library. To build the test on different platform,
// 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 {
if
err
!=
nil
{
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
)
if
err
!=
nil
{
panic
(
err
)
...
...
fs/mem_test.go
View file @
135f7059
...
...
@@ -137,8 +137,7 @@ func TestDataFile(t *testing.T) {
if
err
:=
syscall
.
Lstat
(
mntDir
+
"/file"
,
&
st
);
err
!=
nil
{
t
.
Fatalf
(
"Lstat: %v"
,
err
)
}
if
want
:=
uint32
(
syscall
.
S_IFREG
|
0464
);
st
.
Mode
!=
want
{
if
want
:=
uint
(
syscall
.
S_IFREG
|
0464
);
uint
(
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 (
"testing"
"github.com/hanwen/go-fuse/v2/fuse"
"golang.org/x/sys/unix"
)
func
TestReadonlyCreate
(
t
*
testing
.
T
)
{
root
:=
&
Inode
{}
mntDir
,
_
:=
testMount
(
t
,
root
,
nil
)
_
,
err
:=
syscall
.
Creat
(
mntDir
+
"/test"
,
0644
)
_
,
err
:=
unix
.
Open
(
mntDir
+
"/test"
,
unix
.
O_CREAT
,
0644
)
if
want
:=
syscall
.
EROFS
;
want
!=
err
{
t
.
Fatalf
(
"got err %v, want %v"
,
err
,
want
)
}
...
...
@@ -44,7 +44,7 @@ func TestDefaultPermissions(t *testing.T) {
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Lstat
(
filepath
.
Join
(
mntDir
,
k
),
&
st
);
err
!=
nil
{
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
)
}
}
...
...
fs/simple_test.go
View file @
135f7059
...
...
@@ -25,6 +25,7 @@ import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/internal/testutil"
"github.com/hanwen/go-fuse/v2/posixtest"
"golang.org/x/sys/unix"
)
type
testCase
struct
{
...
...
@@ -339,7 +340,7 @@ func TestMknod(t *testing.T) {
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Stat
(
p
,
&
st
);
err
!=
nil
{
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
)
}
}
...
...
@@ -648,7 +649,7 @@ func TestStaleHardlinks(t *testing.T) {
// "link0" is original file
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
)
}
else
{
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