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
589723ca
Commit
589723ca
authored
May 19, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Plain Diff
Tightened up symlink tests, in particular around removing.
parents
2f23b2ca
32c4d03a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
6 deletions
+49
-6
fuseops/ops.go
fuseops/ops.go
+5
-4
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+44
-2
No files found.
fuseops/ops.go
View file @
589723ca
...
...
@@ -436,15 +436,16 @@ func (o *RmDirOp) toBazilfuseResponse() (bfResp interface{}) {
return
}
// Unlink a file from its parent. If this brings the inode's link count to
// zero, the inode should be deleted once the kernel sends ForgetInodeOp. It
// may still be referenced before then if a user still has the file open.
// Unlink a file or symlink from its parent. If this brings the inode's link
// count to zero, the inode should be deleted once the kernel sends
// ForgetInodeOp. It may still be referenced before then if a user still has
// the file open.
//
// Sample implementation in ext2: ext2_unlink (http://goo.gl/hY6r6C)
type
UnlinkOp
struct
{
commonOp
// The ID of parent directory inode, and the name of the
file
being removed
// The ID of parent directory inode, and the name of the
entry
being removed
// within it.
Parent
InodeID
Name
string
...
...
samples/memfs/memfs_test.go
View file @
589723ca
...
...
@@ -1136,19 +1136,36 @@ func (t *MemFSTest) HardLinks() {
}
func
(
t
*
MemFSTest
)
CreateSymlink
()
{
var
fi
os
.
FileInfo
var
err
error
symlinkName
:=
path
.
Join
(
t
.
Dir
,
"foo"
)
target
:=
"taco/burrito"
// Create.
// Create
the link
.
err
=
os
.
Symlink
(
target
,
symlinkName
)
AssertEq
(
nil
,
err
)
// Read
// Stat the link.
fi
,
err
=
os
.
Lstat
(
symlinkName
)
AssertEq
(
nil
,
err
)
ExpectEq
(
"foo"
,
fi
.
Name
())
ExpectEq
(
0444
|
os
.
ModeSymlink
,
fi
.
Mode
())
// Read the link.
actual
,
err
:=
os
.
Readlink
(
symlinkName
)
AssertEq
(
nil
,
err
)
ExpectEq
(
target
,
actual
)
// Read the parent directory.
entries
,
err
:=
fusetesting
.
ReadDirPicky
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
AssertEq
(
1
,
len
(
entries
))
fi
=
entries
[
0
]
ExpectEq
(
"foo"
,
fi
.
Name
())
ExpectEq
(
0444
|
os
.
ModeSymlink
,
fi
.
Mode
())
}
func
(
t
*
MemFSTest
)
CreateSymlink_AlreadyExists
()
{
...
...
@@ -1209,3 +1226,28 @@ func (t *MemFSTest) ReadLink_NotASymlink() {
ExpectThat
(
err
,
Error
(
HasSubstr
(
"invalid argument"
)))
}
}
func
(
t
*
MemFSTest
)
DeleteSymlink
()
{
var
err
error
symlinkName
:=
path
.
Join
(
t
.
Dir
,
"foo"
)
target
:=
"taco/burrito"
// Create the link.
err
=
os
.
Symlink
(
target
,
symlinkName
)
AssertEq
(
nil
,
err
)
// Remove it.
err
=
os
.
Remove
(
symlinkName
)
AssertEq
(
nil
,
err
)
// Statting should now fail.
_
,
err
=
os
.
Lstat
(
symlinkName
)
ExpectTrue
(
os
.
IsNotExist
(
err
),
"err: %v"
,
err
)
// Read the parent directory.
entries
,
err
:=
fusetesting
.
ReadDirPicky
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
ExpectThat
(
entries
,
ElementsAre
())
}
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