Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-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
Levin Zimmermann
go-fuse
Commits
88feb302
Commit
88feb302
authored
May 10, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo: use links variable for retrieving symlinks.
Add tests.
parent
6281a8be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
2 deletions
+75
-2
unionfs/cachingfs.go
unionfs/cachingfs.go
+1
-1
unionfs/cachingfs_test.go
unionfs/cachingfs_test.go
+73
-0
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+1
-1
No files found.
unionfs/cachingfs.go
View file @
88feb302
...
...
@@ -161,7 +161,7 @@ func (me *CachingFileSystem) GetXAttr(name string, attr string) ([]byte, fuse.St
}
func
(
me
*
CachingFileSystem
)
Readlink
(
name
string
)
(
string
,
fuse
.
Status
)
{
r
:=
me
.
attribute
s
.
Get
(
name
)
.
(
*
linkResponse
)
r
:=
me
.
link
s
.
Get
(
name
)
.
(
*
linkResponse
)
return
r
.
linkContent
,
r
.
Status
}
...
...
unionfs/cachingfs_test.go
0 → 100644
View file @
88feb302
package
unionfs
import
(
"os"
"github.com/hanwen/go-fuse/fuse"
"fmt"
"log"
"syscall"
"testing"
)
var
_
=
fmt
.
Print
var
_
=
log
.
Print
func
modeMapEq
(
m1
,
m2
map
[
string
]
uint32
)
bool
{
if
len
(
m1
)
!=
len
(
m2
)
{
return
false
}
for
k
,
v
:=
range
m1
{
val
,
ok
:=
m2
[
k
]
if
!
ok
||
val
!=
v
{
return
false
}
}
return
true
}
func
TestCachingFs
(
t
*
testing
.
T
)
{
wd
:=
fuse
.
MakeTempDir
()
defer
os
.
RemoveAll
(
wd
)
fs
:=
fuse
.
NewLoopbackFileSystem
(
wd
)
cfs
:=
NewCachingFileSystem
(
fs
,
0
)
os
.
Mkdir
(
wd
+
"/orig"
,
0755
)
fi
,
code
:=
cfs
.
GetAttr
(
"orig"
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"GetAttr failure"
,
code
)
}
if
!
fi
.
IsDirectory
()
{
t
.
Error
(
"unexpected attr"
,
fi
)
}
os
.
Symlink
(
"orig"
,
wd
+
"/symlink"
)
val
,
code
:=
cfs
.
Readlink
(
"symlink"
)
if
val
!=
"orig"
{
t
.
Error
(
"unexpected readlink"
,
val
)
}
if
!
code
.
Ok
()
{
t
.
Error
(
"code !ok "
,
code
)
}
stream
,
code
:=
cfs
.
OpenDir
(
""
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"Readdir fail"
,
code
)
}
results
:=
make
(
map
[
string
]
uint32
)
for
v
:=
range
stream
{
results
[
v
.
Name
]
=
v
.
Mode
&^
07777
}
expected
:=
map
[
string
]
uint32
{
"symlink"
:
syscall
.
S_IFLNK
,
"orig"
:
fuse
.
S_IFDIR
,
}
if
!
modeMapEq
(
results
,
expected
)
{
t
.
Error
(
"Unexpected readdir result"
,
results
,
expected
)
}
}
unionfs/unionfs_test.go
View file @
88feb302
...
...
@@ -102,7 +102,7 @@ func mapEq(m1, m2 map[string]bool) bool {
}
for
k
,
v
:=
range
m1
{
ok
,
val
:=
m2
[
k
]
val
,
ok
:=
m2
[
k
]
if
!
ok
||
val
!=
v
{
return
false
}
...
...
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