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
147be063
Commit
147be063
authored
Mar 03, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for the Nlink field.
parent
651984dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+14
-0
No files found.
samples/memfs/memfs_test.go
View file @
147be063
...
...
@@ -160,6 +160,7 @@ func (t *MemFSTest) Mkdir_OneLevel() {
ExpectEq
(
0
,
fi
.
ModTime
()
.
Sub
(
createTime
))
ExpectTrue
(
fi
.
IsDir
())
ExpectNe
(
0
,
stat
.
Ino
)
ExpectEq
(
1
,
stat
.
Nlink
)
ExpectEq
(
currentUid
(),
stat
.
Uid
)
ExpectEq
(
currentGid
(),
stat
.
Gid
)
...
...
@@ -214,6 +215,7 @@ func (t *MemFSTest) Mkdir_TwoLevels() {
ExpectEq
(
0
,
fi
.
ModTime
()
.
Sub
(
createTime
))
ExpectTrue
(
fi
.
IsDir
())
ExpectNe
(
0
,
stat
.
Ino
)
ExpectEq
(
1
,
stat
.
Nlink
)
ExpectEq
(
currentUid
(),
stat
.
Uid
)
ExpectEq
(
currentGid
(),
stat
.
Gid
)
...
...
@@ -403,9 +405,13 @@ func (t *MemFSTest) Rmdir_OpenedForReading() {
var
err
error
// Create a directory.
createTime
:=
t
.
clock
.
Now
()
err
=
os
.
Mkdir
(
path
.
Join
(
t
.
mfs
.
Dir
(),
"dir"
),
0700
)
AssertEq
(
nil
,
err
)
// Simulate time advancing.
t
.
clock
.
AdvanceTime
(
time
.
Second
)
// Open the directory for reading.
f
,
err
:=
os
.
Open
(
path
.
Join
(
t
.
mfs
.
Dir
(),
"dir"
))
defer
func
()
{
...
...
@@ -431,6 +437,14 @@ func (t *MemFSTest) Rmdir_OpenedForReading() {
err
=
os
.
MkdirAll
(
path
.
Join
(
t
.
mfs
.
Dir
(),
"dir/baz"
),
0700
)
AssertEq
(
nil
,
err
)
// We should still be able to stat the open file handle. It should show up as
// unlinked.
fi
,
err
:=
f
.
Stat
()
ExpectEq
(
"dir"
,
fi
.
Name
())
ExpectEq
(
0
,
fi
.
ModTime
()
.
Sub
(
createTime
))
ExpectEq
(
0
,
fi
.
Sys
()
.
(
*
syscall
.
Stat_t
)
.
Nlink
)
// Attempt to read from the directory. This should succeed even though it has
// been unlinked, and we shouldn't see any junk from the new directory.
entries
,
err
:=
f
.
Readdir
(
0
)
...
...
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