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
e2f3ca71
Commit
e2f3ca71
authored
Mar 20, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FlushFSTest.Dup2
parent
7fd16bbf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
samples/flushfs/flush_fs_test.go
samples/flushfs/flush_fs_test.go
+39
-1
No files found.
samples/flushfs/flush_fs_test.go
View file @
e2f3ca71
...
...
@@ -16,6 +16,7 @@ package flushfs_test
import
(
"io"
"io/ioutil"
"os"
"path"
"sync"
...
...
@@ -541,7 +542,44 @@ func (t *FlushFSTest) Dup_FlushError() {
}
func
(
t
*
FlushFSTest
)
Dup2
()
{
AssertTrue
(
false
,
"TODO"
)
var
n
int
var
err
error
var
f1
*
os
.
File
var
f2
*
os
.
File
defer
func
()
{
if
f1
!=
nil
{
ExpectEq
(
nil
,
f1
.
Close
())
}
if
f2
!=
nil
{
ExpectEq
(
nil
,
f2
.
Close
())
}
}()
// Open the file.
f1
,
err
=
os
.
OpenFile
(
path
.
Join
(
t
.
Dir
,
"foo"
),
os
.
O_WRONLY
,
0
)
AssertEq
(
nil
,
err
)
// Write some contents to the file.
n
,
err
=
f1
.
Write
([]
byte
(
"taco"
))
AssertEq
(
nil
,
err
)
AssertEq
(
4
,
n
)
// Open and unlink some temporary file.
f2
,
err
=
ioutil
.
TempFile
(
""
,
""
)
AssertEq
(
nil
,
err
)
err
=
os
.
Remove
(
f2
.
Name
())
AssertEq
(
nil
,
err
)
// Duplicate the temporary file descriptor on top of the file from our file
// system. We should see a flush.
err
=
syscall
.
Dup2
(
int
(
f2
.
Fd
()),
int
(
f1
.
Fd
()))
ExpectEq
(
nil
,
err
)
ExpectThat
(
t
.
getFlushes
(),
ElementsAre
(
"taco"
))
ExpectThat
(
t
.
getFsyncs
(),
ElementsAre
())
}
func
(
t
*
FlushFSTest
)
Dup2_FlushError
()
{
...
...
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