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
675a48a2
Commit
675a48a2
authored
Feb 25, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move fallocate test to linux specific too. Check kernel
interface version.
parent
e00427dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
22 deletions
+28
-22
fuse/loopback_linux_test.go
fuse/loopback_linux_test.go
+28
-0
fuse/loopback_test.go
fuse/loopback_test.go
+0
-22
No files found.
fuse/loopback_linux_test.go
View file @
675a48a2
...
...
@@ -40,3 +40,31 @@ func clearStatfs(s *syscall.Statfs_t) {
// TODO - figure out what this is for.
s
.
Flags
=
0
}
func
TestFallocate
(
t
*
testing
.
T
)
{
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
if
ts
.
state
.
KernelSettings
()
.
Minor
<
19
{
t
.
Log
(
"FUSE does not support Fallocate."
)
return
}
rwFile
,
err
:=
os
.
OpenFile
(
ts
.
mnt
+
"/file"
,
os
.
O_CREATE
|
os
.
O_WRONLY
|
os
.
O_TRUNC
,
0666
)
if
err
!=
nil
{
t
.
Fatalf
(
"OpenFile failed: %v"
,
err
)
}
defer
rwFile
.
Close
()
err
=
syscall
.
Fallocate
(
int
(
rwFile
.
Fd
()),
0
,
1024
,
4096
)
if
err
!=
nil
{
t
.
Fatalf
(
"FUSE Fallocate failed: %v"
,
err
)
}
fi
,
err
:=
os
.
Lstat
(
ts
.
orig
+
"/file"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Lstat failed: %v"
,
err
)
}
if
fi
.
Size
()
<
(
1024
+
4096
)
{
t
.
Fatalf
(
"fallocate should have changed file size. Got %d bytes"
,
fi
.
Size
())
}
}
fuse/loopback_test.go
View file @
675a48a2
...
...
@@ -979,25 +979,3 @@ func TestUmask(t *testing.T) {
t
.
Errorf
(
"got %o, expect mode %o for file %s"
,
got
,
expect
,
fn
)
}
}
func
TestFallocate
(
t
*
testing
.
T
)
{
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
rwFile
,
err
:=
os
.
OpenFile
(
ts
.
mnt
+
"/file"
,
os
.
O_CREATE
|
os
.
O_WRONLY
|
os
.
O_TRUNC
,
0666
)
if
err
!=
nil
{
t
.
Fatalf
(
"OpenFile failed: %v"
,
err
)
}
defer
rwFile
.
Close
()
err
=
syscall
.
Fallocate
(
int
(
rwFile
.
Fd
()),
0
,
1024
,
4096
)
if
err
!=
nil
{
t
.
Fatalf
(
"Fallocate failed: %v"
,
err
)
}
fi
,
err
:=
os
.
Lstat
(
ts
.
orig
+
"/file"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Lstat failed: %v"
,
err
)
}
if
fi
.
Size
()
<
(
1024
+
4096
)
{
t
.
Fatalf
(
"fallocate should have changed file size. Got %d bytes"
,
fi
.
Size
())
}
}
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