Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
jacobsa-fuse
Commits
04dad40a
Commit
04dad40a
authored
Jul 29, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PageCacheTest.TwoFileHandles_KeepCache
parent
454f3959
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
samples/cachingfs/caching_fs_test.go
samples/cachingfs/caching_fs_test.go
+41
-1
No files found.
samples/cachingfs/caching_fs_test.go
View file @
04dad40a
...
...
@@ -671,5 +671,45 @@ func (t *PageCacheTest) TwoFileHandles_NoKeepCache() {
}
func
(
t
*
PageCacheTest
)
TwoFileHandles_KeepCache
()
{
AssertTrue
(
false
,
"TODO"
)
t
.
fs
.
SetKeepCache
(
true
)
// Open the file.
f1
,
err
:=
os
.
Open
(
path
.
Join
(
t
.
Dir
,
"foo"
))
AssertEq
(
nil
,
err
)
defer
f1
.
Close
()
// Read its contents once.
f1
.
Seek
(
0
,
0
)
AssertEq
(
nil
,
err
)
c1
,
err
:=
ioutil
.
ReadAll
(
f1
)
AssertEq
(
nil
,
err
)
AssertEq
(
cachingfs
.
FooSize
,
len
(
c1
))
// Open a second handle.
f2
,
err
:=
os
.
Open
(
path
.
Join
(
t
.
Dir
,
"foo"
))
AssertEq
(
nil
,
err
)
defer
f2
.
Close
()
// We should see the same contents when we read via the second handle.
f2
.
Seek
(
0
,
0
)
AssertEq
(
nil
,
err
)
c2
,
err
:=
ioutil
.
ReadAll
(
f2
)
AssertEq
(
nil
,
err
)
AssertEq
(
cachingfs
.
FooSize
,
len
(
c2
))
ExpectTrue
(
bytes
.
Equal
(
c1
,
c2
))
// Ditto if we read again from the first.
f1
.
Seek
(
0
,
0
)
AssertEq
(
nil
,
err
)
c3
,
err
:=
ioutil
.
ReadAll
(
f1
)
AssertEq
(
nil
,
err
)
AssertEq
(
cachingfs
.
FooSize
,
len
(
c3
))
ExpectTrue
(
bytes
.
Equal
(
c1
,
c3
))
}
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