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
e51db3a8
Commit
e51db3a8
authored
Aug 23, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test FOPEN_NONSEEKABLE.
parent
48a44784
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
2 deletions
+52
-2
fuse/cache_test.go
fuse/cache_test.go
+52
-2
No files found.
fuse/cache_test.go
View file @
e51db3a8
package
fuse
import
(
"testing"
"os"
"bytes"
"io/ioutil"
"os"
"testing"
)
type
cacheFs
struct
{
...
...
@@ -81,3 +82,52 @@ func TestCacheFs(t *testing.T) {
t
.
Fatalf
(
"expect '%s' %q"
,
content2
,
string
(
c
))
}
}
type
nonseekFs
struct
{
DefaultFileSystem
Length
int
}
func
(
me
*
nonseekFs
)
GetAttr
(
name
string
)
(
fi
*
os
.
FileInfo
,
status
Status
)
{
if
name
==
"file"
{
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
},
OK
}
return
nil
,
ENOENT
}
func
(
me
*
nonseekFs
)
Open
(
name
string
,
flags
uint32
)
(
fuseFile
File
,
status
Status
)
{
if
name
!=
"file"
{
return
nil
,
ENOENT
}
data
:=
bytes
.
Repeat
([]
byte
{
42
},
me
.
Length
)
f
:=
NewReadOnlyFile
(
data
)
return
&
WithFlags
{
File
:
f
,
Flags
:
FOPEN_NONSEEKABLE
,
},
OK
}
func
TestNonseekable
(
t
*
testing
.
T
)
{
fs
:=
&
nonseekFs
{}
fs
.
Length
=
200
*
1024
dir
:=
MakeTempDir
()
defer
os
.
RemoveAll
(
dir
)
state
,
_
,
err
:=
MountFileSystem
(
dir
,
fs
,
nil
)
CheckSuccess
(
err
)
state
.
Debug
=
true
defer
state
.
Unmount
()
go
state
.
Loop
(
false
)
f
,
err
:=
os
.
Open
(
dir
+
"/file"
)
CheckSuccess
(
err
)
defer
f
.
Close
()
b
:=
make
([]
byte
,
200
)
n
,
err
:=
f
.
ReadAt
(
b
,
20
)
if
err
==
nil
||
n
>
0
{
t
.
Errorf
(
"file was opened nonseekable, but seek successful"
)
}
}
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