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
d5cd319a
Commit
d5cd319a
authored
Sep 09, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Share code for canonicalizing the mount point.
parent
55d02a11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
samples/statfs/statfs_test.go
samples/statfs/statfs_test.go
+12
-12
No files found.
samples/statfs/statfs_test.go
View file @
d5cd319a
...
...
@@ -55,6 +55,9 @@ func convertName(in []int8) (s string) {
type
StatFSTest
struct
{
samples
.
SampleTest
fs
statfs
.
FS
// t.Dir, with symlinks resolved and redundant path components removed.
canonicalDir
string
}
var
_
SetUpInterface
=
&
StatFSTest
{}
...
...
@@ -63,6 +66,8 @@ var _ TearDownInterface = &StatFSTest{}
func
init
()
{
RegisterTestSuite
(
&
StatFSTest
{})
}
func
(
t
*
StatFSTest
)
SetUp
(
ti
*
TestInfo
)
{
var
err
error
// Writeback caching can ruin our measurement of the write sizes the kernel
// decides to give us, since it causes write acking to race against writes
// being issued from the client.
...
...
@@ -74,6 +79,11 @@ func (t *StatFSTest) SetUp(ti *TestInfo) {
// Mount it.
t
.
SampleTest
.
SetUp
(
ti
)
// Canonicalize the mount point.
t
.
canonicalDir
,
err
=
filepath
.
EvalSymlinks
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
t
.
canonicalDir
=
path
.
Clean
(
t
.
canonicalDir
)
}
////////////////////////////////////////////////////////////////////////
...
...
@@ -84,11 +94,6 @@ func (t *StatFSTest) Syscall_ZeroValues() {
var
err
error
var
stat
syscall
.
Statfs_t
// Compute the canonicalized directory, for use below.
canonicalDir
,
err
:=
filepath
.
EvalSymlinks
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
canonicalDir
=
path
.
Clean
(
canonicalDir
)
// Call without configuring a canned response, meaning the OS will see the
// zero value for each field. The assertions below act as documentation for
// the OS's behavior in this case.
...
...
@@ -103,7 +108,7 @@ func (t *StatFSTest) Syscall_ZeroValues() {
ExpectEq
(
0
,
stat
.
Files
)
ExpectEq
(
0
,
stat
.
Ffree
)
ExpectEq
(
"osxfusefs"
,
convertName
(
stat
.
Fstypename
[
:
]))
ExpectEq
(
canonicalDir
,
convertName
(
stat
.
Mntonname
[
:
]))
ExpectEq
(
t
.
canonicalDir
,
convertName
(
stat
.
Mntonname
[
:
]))
ExpectThat
(
convertName
(
stat
.
Mntfromname
[
:
]),
MatchesRegexp
(
`mount_osxfusefs@osxfuse\d+`
))
...
...
@@ -127,11 +132,6 @@ func (t *StatFSTest) Syscall_NonZeroValues() {
t
.
fs
.
SetStatFSResponse
(
canned
)
// Compute the canonicalized directory, for use below.
canonicalDir
,
err
:=
filepath
.
EvalSymlinks
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
canonicalDir
=
path
.
Clean
(
canonicalDir
)
// Stat.
err
=
syscall
.
Statfs
(
t
.
Dir
,
&
stat
)
AssertEq
(
nil
,
err
)
...
...
@@ -144,7 +144,7 @@ func (t *StatFSTest) Syscall_NonZeroValues() {
ExpectEq
(
canned
.
Inodes
,
stat
.
Files
)
ExpectEq
(
canned
.
InodesFree
,
stat
.
Ffree
)
ExpectEq
(
"osxfusefs"
,
convertName
(
stat
.
Fstypename
[
:
]))
ExpectEq
(
canonicalDir
,
convertName
(
stat
.
Mntonname
[
:
]))
ExpectEq
(
t
.
canonicalDir
,
convertName
(
stat
.
Mntonname
[
:
]))
ExpectThat
(
convertName
(
stat
.
Mntfromname
[
:
]),
MatchesRegexp
(
`mount_osxfusefs@osxfuse\d+`
))
...
...
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