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
ca114f29
Commit
ca114f29
authored
Sep 09, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed most tests on Linux.
parent
56d02493
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
32 deletions
+34
-32
fuseops/ops.go
fuseops/ops.go
+3
-2
samples/statfs/statfs_linux_test.go
samples/statfs/statfs_linux_test.go
+20
-29
samples/statfs/statfs_test.go
samples/statfs/statfs_test.go
+11
-1
No files found.
fuseops/ops.go
View file @
ca114f29
...
...
@@ -46,8 +46,9 @@ type StatFSOp struct {
// with the block counts below, by callers of statfs(2) to infer the file
// system's capacity and space availability.
//
// TODO(jacobsa): Document the range of values accepted on OS X and Linux.
// Cite sources in Linux if possible.
// On Linux this can be any value, which will be faitfully returned to the
// caller of statfs(2) (see the code walk above). On OS X it appears it must
// be a power of 2 in [2^9, 2^17].
//
// On OS X this also affects statfs::f_iosize, which is documented as the
// "optimal transfer block size". It does not appear to cause osxfuse to
...
...
samples/statfs/statfs_linux_test.go
View file @
ca114f29
...
...
@@ -16,6 +16,7 @@ package statfs_test
import
(
"fmt"
"math"
"syscall"
"github.com/jacobsa/fuse/fuseops"
...
...
@@ -36,8 +37,8 @@ func (t *StatFSTest) Syscall_ZeroValues() {
err
=
syscall
.
Statfs
(
t
.
Dir
,
&
stat
)
AssertEq
(
nil
,
err
)
ExpectEq
(
4096
,
stat
.
Bsize
)
ExpectEq
(
65536
,
stat
.
Frsize
)
ExpectEq
(
0
,
stat
.
Bsize
)
ExpectEq
(
0
,
stat
.
Frsize
)
ExpectEq
(
0
,
stat
.
Blocks
)
ExpectEq
(
0
,
stat
.
Bfree
)
ExpectEq
(
0
,
stat
.
Bavail
)
...
...
@@ -76,38 +77,28 @@ func (t *StatFSTest) Syscall_NonZeroValues() {
ExpectEq
(
canned
.
InodesFree
,
stat
.
Ffree
)
}
func
(
t
*
StatFSTest
)
Unsupported
BlockSizes
()
{
func
(
t
*
StatFSTest
)
Wacky
BlockSizes
()
{
var
err
error
// Test a bunch of block sizes that the OS doesn't support faithfully,
// checking what it transforms them too.
testCases
:=
[]
struct
{
fsBlockSize
uint32
expectedBsize
uint32
expectedFrsize
uint32
}{
0
:
{
0
,
4096
,
65536
},
1
:
{
1
,
512
,
512
},
2
:
{
3
,
512
,
512
},
3
:
{
511
,
512
,
512
},
4
:
{
513
,
1024
,
1024
},
5
:
{
1023
,
1024
,
1024
},
6
:
{
4095
,
4096
,
4096
},
7
:
{
1
<<
17
-
1
,
1
<<
17
,
131072
},
8
:
{
1
<<
17
+
1
,
1
<<
17
,
1
<<
18
},
9
:
{
1
<<
18
+
1
,
1
<<
17
,
1
<<
19
},
10
:
{
1
<<
19
+
1
,
1
<<
17
,
1
<<
20
},
11
:
{
1
<<
20
+
1
,
1
<<
17
,
1
<<
20
},
12
:
{
1
<<
21
,
1
<<
17
,
1
<<
20
},
13
:
{
1
<<
30
,
1
<<
17
,
1
<<
20
},
// Test a bunch of weird block sizes that OS X would be cranky about.
blockSizes
:=
[]
uint32
{
0
,
1
,
3
,
17
,
1
<<
20
-
1
,
1
<<
20
+
0
,
1
<<
20
+
1
,
math
.
MaxInt32
,
math
.
MaxUint32
,
}
for
i
,
tc
:=
range
testCas
es
{
desc
:=
fmt
.
Sprintf
(
"
Case %d: block size %d"
,
i
,
tc
.
fsBlockSize
)
for
_
,
bs
:=
range
blockSiz
es
{
desc
:=
fmt
.
Sprintf
(
"
block size %d"
,
bs
)
// Set up.
canned
:=
fuseops
.
StatFSOp
{
BlockSize
:
tc
.
fsBlockSize
,
BlockSize
:
bs
,
Blocks
:
10
,
}
...
...
@@ -118,7 +109,7 @@ func (t *StatFSTest) UnsupportedBlockSizes() {
err
=
syscall
.
Statfs
(
t
.
Dir
,
&
stat
)
AssertEq
(
nil
,
err
)
ExpectEq
(
tc
.
expectedBsize
,
stat
.
Bsize
,
"%s"
,
desc
)
ExpectEq
(
tc
.
expectedFrsize
,
stat
.
Frsize
,
"%s"
,
desc
)
ExpectEq
(
bs
,
stat
.
Bsize
,
"%s"
,
desc
)
ExpectEq
(
bs
,
stat
.
Frsize
,
"%s"
,
desc
)
}
}
samples/statfs/statfs_test.go
View file @
ca114f29
...
...
@@ -22,6 +22,7 @@ import (
"path"
"path/filepath"
"regexp"
"runtime"
"strconv"
"testing"
...
...
@@ -190,5 +191,14 @@ func (t *StatFSTest) WriteSize() {
// Despite the small block size, the OS shouldn't have given us pitifully
// small chunks of data.
switch
runtime
.
GOOS
{
case
"linux"
:
ExpectEq
(
1
<<
17
,
t
.
fs
.
MostRecentWriteSize
())
case
"darwin"
:
ExpectEq
(
1
<<
20
,
t
.
fs
.
MostRecentWriteSize
())
default
:
AddFailure
(
"Unhandled OS: %s"
,
runtime
.
GOOS
)
}
}
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