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
597e1264
Commit
597e1264
authored
Mar 24, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NoErrorsTest.Mmap_WithMsync_MunmapBeforeClose
parent
0888482d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
2 deletions
+46
-2
samples/flushfs/flush_fs_test.go
samples/flushfs/flush_fs_test.go
+46
-2
No files found.
samples/flushfs/flush_fs_test.go
View file @
597e1264
...
@@ -583,9 +583,10 @@ func (t *NoErrorsTest) Mmap_NoMsync_MunmapBeforeClose() {
...
@@ -583,9 +583,10 @@ func (t *NoErrorsTest) Mmap_NoMsync_MunmapBeforeClose() {
AssertEq
(
nil
,
err
)
AssertEq
(
nil
,
err
)
AssertEq
(
"taco"
,
string
(
data
))
AssertEq
(
"taco"
,
string
(
data
))
// Modify the
n unmap
.
// Modify the
contents
.
data
[
0
]
=
'p'
data
[
0
]
=
'p'
// Unmap.
err
=
syscall
.
Munmap
(
data
)
err
=
syscall
.
Munmap
(
data
)
AssertEq
(
nil
,
err
)
AssertEq
(
nil
,
err
)
...
@@ -650,7 +651,50 @@ func (t *NoErrorsTest) Mmap_NoMsync_CloseBeforeMunmap() {
...
@@ -650,7 +651,50 @@ func (t *NoErrorsTest) Mmap_NoMsync_CloseBeforeMunmap() {
}
}
func
(
t
*
NoErrorsTest
)
Mmap_WithMsync_MunmapBeforeClose
()
{
func
(
t
*
NoErrorsTest
)
Mmap_WithMsync_MunmapBeforeClose
()
{
AssertTrue
(
false
,
"TODO"
)
var
n
int
var
err
error
// Open the file.
t
.
f1
,
err
=
os
.
OpenFile
(
path
.
Join
(
t
.
Dir
,
"foo"
),
os
.
O_RDWR
,
0
)
AssertEq
(
nil
,
err
)
// Write some contents to the file.
n
,
err
=
t
.
f1
.
Write
([]
byte
(
"taco"
))
AssertEq
(
nil
,
err
)
AssertEq
(
4
,
n
)
// mmap the file.
data
,
err
:=
syscall
.
Mmap
(
int
(
t
.
f1
.
Fd
()),
0
,
4
,
syscall
.
PROT_READ
|
syscall
.
PROT_WRITE
,
syscall
.
MAP_SHARED
)
AssertEq
(
nil
,
err
)
AssertEq
(
"taco"
,
string
(
data
))
// Modify the contents.
data
[
0
]
=
'p'
// msync. This causes a write, but not a flush.
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
())
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
// Unmap. Again, this does not cause a flush.
err
=
syscall
.
Munmap
(
data
)
AssertEq
(
nil
,
err
)
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
())
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
// Close the file. We should now see a flush with the modified contents, even
// on OS X, which works differently from Linux with regard to flushing dirty
// pages (cf. https://github.com/osxfuse/osxfuse/issues/202).
err
=
t
.
f1
.
Close
()
t
.
f1
=
nil
AssertEq
(
nil
,
err
)
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
"paco"
))
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
}
}
func
(
t
*
NoErrorsTest
)
Mmap_WithMsync_CloseBeforeMunmap
()
{
func
(
t
*
NoErrorsTest
)
Mmap_WithMsync_CloseBeforeMunmap
()
{
...
...
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