Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
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
go
Commits
92b4506f
Commit
92b4506f
authored
Dec 09, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os: fix test of RemoveAll
Fixes #22. (again) R=r CC=golang-dev
https://golang.org/cl/3547041
parent
6555cfc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
src/pkg/os/path_test.go
src/pkg/os/path_test.go
+11
-17
No files found.
src/pkg/os/path_test.go
View file @
92b4506f
...
...
@@ -130,23 +130,17 @@ func TestRemoveAll(t *testing.T) {
if
err
=
Chmod
(
dpath
,
0
);
err
!=
nil
{
t
.
Fatalf
(
"Chmod %q 0: %s"
,
dpath
,
err
)
}
if
err
=
RemoveAll
(
path
);
err
==
nil
{
_
,
err
:=
Lstat
(
path
)
if
err
==
nil
{
t
.
Errorf
(
"Can lstat %q after supposed RemoveAll"
,
path
)
}
t
.
Fatalf
(
"RemoveAll %q succeeded with chmod 0 subdirectory: err %s"
,
path
,
err
)
}
perr
,
ok
:=
err
.
(
*
PathError
)
if
!
ok
{
t
.
Fatalf
(
"RemoveAll %q returned %T not *PathError"
,
path
,
err
)
}
if
perr
.
Path
!=
dpath
{
t
.
Fatalf
(
"RemoveAll %q failed at %q not %q"
,
path
,
perr
.
Path
,
dpath
)
}
if
err
=
Chmod
(
dpath
,
0777
);
err
!=
nil
{
t
.
Fatalf
(
"Chmod %q 0777: %s"
,
dpath
,
err
)
}
// No error checking here: either RemoveAll
// will or won't be able to remove dpath;
// either way we want to see if it removes fpath
// and path/zzz. Reasons why RemoveAll might
// succeed in removing dpath as well include:
// * running as root
// * running on a file system without permissions (FAT)
RemoveAll
(
path
)
Chmod
(
dpath
,
0777
)
for
_
,
s
:=
range
[]
string
{
fpath
,
path
+
"/zzz"
}
{
if
_
,
err
:=
Lstat
(
s
);
err
==
nil
{
t
.
Fatalf
(
"Lstat %q succeeded after partial RemoveAll"
,
s
)
...
...
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