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
4c2b5911
Commit
4c2b5911
authored
Aug 29, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add failing test for rm -rf.
parent
426a23cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+35
-1
No files found.
unionfs/unionfs_test.go
View file @
4c2b5911
package
unionfs
package
unionfs
import
(
import
(
"exec"
"os"
"os"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse"
"io/ioutil"
"io/ioutil"
...
@@ -53,8 +54,9 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
...
@@ -53,8 +54,9 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
NegativeTimeout
:
.5
*
entryTtl
,
NegativeTimeout
:
.5
*
entryTtl
,
}
}
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
conn
.
Debug
=
true
state
.
Debug
=
true
state
.
Debug
=
true
go
state
.
Loop
(
false
)
go
state
.
Loop
(
false
)
...
@@ -672,6 +674,38 @@ func TestRemoveAll(t *testing.T) {
...
@@ -672,6 +674,38 @@ func TestRemoveAll(t *testing.T) {
}
}
}
}
func
TestRmRf
(
t
*
testing
.
T
)
{
t
.
Log
(
"TestRemoveAll"
)
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
MkdirAll
(
wd
+
"/ro/dir/subdir"
,
0755
)
CheckSuccess
(
err
)
contents
:=
"hello"
fn
:=
wd
+
"/ro/dir/subdir/y"
err
=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
contents
),
0644
)
CheckSuccess
(
err
)
cmd
:=
exec
.
Command
(
"/bin/rm"
,
"-rf"
,
wd
+
"/mount/dir"
)
err
=
cmd
.
Run
()
if
err
!=
nil
{
t
.
Fatal
(
"rm -rf returned error:"
,
err
)
}
for
_
,
f
:=
range
[]
string
{
"dir/subdir/y"
,
"dir/subdir"
,
"dir"
}
{
if
fi
,
_
:=
os
.
Lstat
(
filepath
.
Join
(
wd
,
"mount"
,
f
));
fi
!=
nil
{
t
.
Errorf
(
"file %s should have disappeared: %v"
,
f
,
fi
)
}
}
names
,
err
:=
Readdirnames
(
wd
+
"/rw/DELETIONS"
)
CheckSuccess
(
err
)
if
len
(
names
)
!=
3
{
t
.
Fatal
(
"unexpected names"
,
names
)
}
}
func
Readdirnames
(
dir
string
)
([]
string
,
os
.
Error
)
{
func
Readdirnames
(
dir
string
)
([]
string
,
os
.
Error
)
{
f
,
err
:=
os
.
Open
(
dir
)
f
,
err
:=
os
.
Open
(
dir
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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