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
5f4126a8
Commit
5f4126a8
authored
Aug 15, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test entry notify with cached contents.
parent
bfca2606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
fuse/cache_test.go
fuse/cache_test.go
+21
-7
No files found.
fuse/cache_test.go
View file @
5f4126a8
...
...
@@ -22,7 +22,7 @@ func (me *cacheFs) Open(name string, flags uint32) (fuseFile File, status Status
}
func
setupCacheTest
()
(
string
,
func
())
{
func
setupCacheTest
()
(
string
,
*
FileSystemConnector
,
func
())
{
dir
:=
MakeTempDir
()
os
.
Mkdir
(
dir
+
"/mnt"
,
0755
)
os
.
Mkdir
(
dir
+
"/orig"
,
0755
)
...
...
@@ -30,12 +30,13 @@ func setupCacheTest() (string, func()) {
fs
:=
&
cacheFs
{
LoopbackFileSystem
:
NewLoopbackFileSystem
(
dir
+
"/orig"
),
}
state
,
_
,
err
:=
MountFileSystem
(
dir
+
"/mnt"
,
fs
,
nil
)
state
,
conn
,
err
:=
MountFileSystem
(
dir
+
"/mnt"
,
fs
,
nil
)
CheckSuccess
(
err
)
state
.
Debug
=
true
conn
.
Debug
=
true
go
state
.
Loop
(
false
)
return
dir
,
func
()
{
return
dir
,
conn
,
func
()
{
err
:=
state
.
Unmount
()
if
err
==
nil
{
os
.
RemoveAll
(
dir
)
...
...
@@ -44,10 +45,12 @@ func setupCacheTest() (string, func()) {
}
func
TestCacheFs
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setupCacheTest
()
wd
,
c
onn
,
c
lean
:=
setupCacheTest
()
defer
clean
()
err
:=
ioutil
.
WriteFile
(
wd
+
"/orig/file.txt"
,
[]
byte
(
"hello"
),
0644
)
content1
:=
"hello"
content2
:=
"qqqq"
err
:=
ioutil
.
WriteFile
(
wd
+
"/orig/file.txt"
,
[]
byte
(
content1
),
0644
)
CheckSuccess
(
err
)
c
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mnt/file.txt"
)
...
...
@@ -57,7 +60,7 @@ func TestCacheFs(t *testing.T) {
t
.
Fatalf
(
"expect 'hello' %q"
,
string
(
c
))
}
err
=
ioutil
.
WriteFile
(
wd
+
"/orig/file.txt"
,
[]
byte
(
"qqqqq"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/orig/file.txt"
,
[]
byte
(
content2
),
0644
)
CheckSuccess
(
err
)
c
,
err
=
ioutil
.
ReadFile
(
wd
+
"/mnt/file.txt"
)
...
...
@@ -66,4 +69,15 @@ func TestCacheFs(t *testing.T) {
if
string
(
c
)
!=
"hello"
{
t
.
Fatalf
(
"expect 'hello' %q"
,
string
(
c
))
}
code
:=
conn
.
EntryNotify
(
""
,
"file.txt"
)
if
!
code
.
Ok
()
{
t
.
Errorf
(
"Entry notify failed: %v"
,
code
)
}
c
,
err
=
ioutil
.
ReadFile
(
wd
+
"/mnt/file.txt"
)
CheckSuccess
(
err
)
if
string
(
c
)
!=
string
(
content2
)
{
t
.
Fatalf
(
"expect '%s' %q"
,
content2
,
string
(
c
))
}
}
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