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
284ddf44
Commit
284ddf44
authored
Sep 09, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MemFSTest.Statfs
parent
ee4f4770
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
samples/memfs/memfs.go
samples/memfs/memfs.go
+6
-0
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+24
-0
No files found.
samples/memfs/memfs.go
View file @
284ddf44
...
...
@@ -28,6 +28,12 @@ import (
"github.com/jacobsa/syncutil"
)
// The capacities of the file system, as reported to statfs(2).
const
(
Capacity_Bytes
=
1
<<
50
Capacity_Files
=
1
<<
30
)
type
memFS
struct
{
fuseutil
.
NotImplementedFileSystem
...
...
samples/memfs/memfs_test.go
View file @
284ddf44
...
...
@@ -1614,3 +1614,27 @@ func (t *MemFSTest) RenameNonExistentFile() {
err
=
os
.
Rename
(
path
.
Join
(
t
.
Dir
,
"foo"
),
path
.
Join
(
t
.
Dir
,
"bar"
))
ExpectThat
(
err
,
Error
(
HasSubstr
(
"no such file"
)))
}
func
(
t
*
MemFSTest
)
Statfs
()
{
var
err
error
var
stat
syscall
.
Statfs_t
// Write a few bytes of file content.
const
content
=
"taco"
err
=
ioutil
.
WriteFile
(
path
.
Join
(
t
.
Dir
,
"foo"
),
[]
byte
(
content
),
0400
)
AssertEq
(
nil
,
err
)
// Stat the file system.
err
=
syscall
.
Statfs
(
t
.
Dir
,
&
stat
)
AssertEq
(
nil
,
err
)
ExpectEq
(
1
,
stat
.
Bsize
)
ExpectEq
(
memfs
.
Capacity_Bytes
,
stat
.
Blocks
)
ExpectEq
(
memfs
.
Capacity_Bytes
-
len
(
content
),
stat
.
Bfree
)
ExpectEq
(
stat
.
Bfree
,
stat
.
Bavail
)
ExpectEq
(
memfs
.
Capacity_Files
,
stat
.
Files
)
ExpectEq
(
memfs
.
Capacity_Files
-
2
,
stat
.
Ffree
)
}
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