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
Kirill Smelkov
go-fuse
Commits
a4673503
Commit
a4673503
authored
Aug 11, 2014
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse/test: don't dereference results if FS calls return error.
parent
8bf34aaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
fuse/test/fsetattr_test.go
fuse/test/fsetattr_test.go
+10
-11
fuse/test/loopback_test.go
fuse/test/loopback_test.go
+9
-6
No files found.
fuse/test/fsetattr_test.go
View file @
a4673503
...
@@ -209,28 +209,27 @@ func TestFSetAttr(t *testing.T) {
...
@@ -209,28 +209,27 @@ func TestFSetAttr(t *testing.T) {
t
.
Error
(
"truncate retval"
,
os
.
NewSyscallError
(
"Ftruncate"
,
code
))
t
.
Error
(
"truncate retval"
,
os
.
NewSyscallError
(
"Ftruncate"
,
code
))
}
}
a
,
status
:=
fs
.
GetAttr
(
"file"
,
nil
)
if
a
,
status
:=
fs
.
GetAttr
(
"file"
,
nil
);
!
status
.
Ok
()
{
if
!
status
.
Ok
()
||
a
.
Size
!=
3
{
t
.
Fatalf
(
"GetAttr: status %v"
,
status
)
}
else
if
a
.
Size
!=
3
{
t
.
Errorf
(
"truncate: size %d, status %v"
,
a
.
Size
,
status
)
t
.
Errorf
(
"truncate: size %d, status %v"
,
a
.
Size
,
status
)
}
}
err
=
f
.
Chmod
(
024
)
if
err
:=
f
.
Chmod
(
024
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Chmod failed: %v"
,
err
)
t
.
Fatalf
(
"Chmod failed: %v"
,
err
)
}
}
a
,
status
=
fs
.
GetAttr
(
"file"
,
nil
)
if
a
,
status
:=
fs
.
GetAttr
(
"file"
,
nil
);
!
status
.
Ok
()
{
if
!
status
.
Ok
()
||
a
.
Mode
&
07777
!=
024
{
t
.
Errorf
(
"chmod: %v"
,
status
)
t
.
Errorf
(
"chmod: %o, status %v"
,
a
.
Mode
&
0777
,
status
)
}
else
if
a
.
Mode
&
07777
!=
024
{
t
.
Errorf
(
"getattr after chmod: %o"
,
a
.
Mode
&
0777
)
}
}
err
=
os
.
Chtimes
(
fn
,
time
.
Unix
(
0
,
100e3
),
time
.
Unix
(
0
,
101e3
))
if
err
:=
os
.
Chtimes
(
fn
,
time
.
Unix
(
0
,
100e3
),
time
.
Unix
(
0
,
101e3
));
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Chtimes failed: %v"
,
err
)
t
.
Fatalf
(
"Chtimes failed: %v"
,
err
)
}
}
a
,
status
=
fs
.
GetAttr
(
"file"
,
nil
)
if
a
,
status
:=
fs
.
GetAttr
(
"file"
,
nil
);
!
status
.
Ok
()
{
if
!
status
.
Ok
()
{
t
.
Errorf
(
"GetAttr: %v"
,
status
)
t
.
Errorf
(
"GetAttr: %v"
,
status
)
}
else
if
a
.
Atimensec
!=
100e3
||
a
.
Mtimensec
!=
101e3
{
}
else
if
a
.
Atimensec
!=
100e3
||
a
.
Mtimensec
!=
101e3
{
t
.
Errorf
(
"Utimens: atime %d != 100e3 mtime %d != 101e3"
,
t
.
Errorf
(
"Utimens: atime %d != 100e3 mtime %d != 101e3"
,
...
...
fuse/test/loopback_test.go
View file @
a4673503
...
@@ -194,6 +194,9 @@ func TestWriteThrough(t *testing.T) {
...
@@ -194,6 +194,9 @@ func TestWriteThrough(t *testing.T) {
}
}
fi
,
err
:=
os
.
Lstat
(
tc
.
origFile
)
fi
,
err
:=
os
.
Lstat
(
tc
.
origFile
)
if
err
!=
nil
{
t
.
Fatalf
(
"Lstat(%q): %v"
,
tc
.
origFile
,
err
)
}
if
fi
.
Mode
()
.
Perm
()
!=
0644
{
if
fi
.
Mode
()
.
Perm
()
!=
0644
{
t
.
Errorf
(
"create mode error %o"
,
fi
.
Mode
()
&
0777
)
t
.
Errorf
(
"create mode error %o"
,
fi
.
Mode
()
&
0777
)
}
}
...
@@ -218,17 +221,17 @@ func TestMkdirRmdir(t *testing.T) {
...
@@ -218,17 +221,17 @@ func TestMkdirRmdir(t *testing.T) {
defer
tc
.
Cleanup
()
defer
tc
.
Cleanup
()
// Mkdir/Rmdir.
// Mkdir/Rmdir.
err
:=
os
.
Mkdir
(
tc
.
mountSubdir
,
0777
)
if
err
:=
os
.
Mkdir
(
tc
.
mountSubdir
,
0777
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Mkdir failed: %v"
,
err
)
t
.
Fatalf
(
"Mkdir failed: %v"
,
err
)
}
}
fi
,
err
:=
os
.
Lstat
(
tc
.
origSubdir
)
if
!
fi
.
IsDir
()
{
if
fi
,
err
:=
os
.
Lstat
(
tc
.
origSubdir
);
err
!=
nil
{
t
.
Fatalf
(
"Lstat(%q): %v"
,
tc
.
origSubdir
,
err
)
}
else
if
!
fi
.
IsDir
()
{
t
.
Errorf
(
"Not a directory: %v"
,
fi
)
t
.
Errorf
(
"Not a directory: %v"
,
fi
)
}
}
err
=
os
.
Remove
(
tc
.
mountSubdir
)
if
err
:=
os
.
Remove
(
tc
.
mountSubdir
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Remove failed: %v"
,
err
)
t
.
Fatalf
(
"Remove failed: %v"
,
err
)
}
}
}
}
...
...
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