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
d6d71a87
Commit
d6d71a87
authored
Jan 13, 2016
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bytes.Repeat for RandomData.
parent
251a9d53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
28 deletions
+12
-28
fuse/test/fsetattr_test.go
fuse/test/fsetattr_test.go
+1
-1
fuse/test/loopback_test.go
fuse/test/loopback_test.go
+11
-27
No files found.
fuse/test/fsetattr_test.go
View file @
d6d71a87
...
...
@@ -172,7 +172,7 @@ func TestDataReadLarge(t *testing.T) {
dir
,
clean
:=
setupFAttrTest
(
t
,
fs
)
defer
clean
()
content
:=
R
andomData
(
385
*
1023
)
content
:=
r
andomData
(
385
*
1023
)
fn
:=
dir
+
"/file"
err
:=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
content
),
0644
)
if
err
!=
nil
{
...
...
fuse/test/loopback_test.go
View file @
d6d71a87
package
test
import
(
"bytes"
"fmt"
"io"
"io/ioutil"
...
...
@@ -141,7 +142,7 @@ func TestReadThrough(t *testing.T) {
tc
:=
NewTestCase
(
t
)
defer
tc
.
Cleanup
()
content
:=
R
andomData
(
125
)
content
:=
r
andomData
(
125
)
tc
.
WriteFile
(
tc
.
origFile
,
content
,
0700
)
err
:=
os
.
Chmod
(
tc
.
mountFile
,
os
.
FileMode
(
mode
))
if
err
!=
nil
{
...
...
@@ -197,7 +198,7 @@ func TestWriteThrough(t *testing.T) {
}
defer
f
.
Close
()
content
:=
R
andomData
(
125
)
content
:=
r
andomData
(
125
)
n
,
err
:=
f
.
Write
(
content
)
if
err
!=
nil
{
t
.
Fatalf
(
"Write failed: %v"
,
err
)
...
...
@@ -253,7 +254,7 @@ func TestLinkCreate(t *testing.T) {
tc
:=
NewTestCase
(
t
)
defer
tc
.
Cleanup
()
content
:=
R
andomData
(
125
)
content
:=
r
andomData
(
125
)
tc
.
WriteFile
(
tc
.
origFile
,
content
,
0700
)
tc
.
Mkdir
(
tc
.
origSubdir
,
0777
)
...
...
@@ -298,13 +299,17 @@ func TestLinkCreate(t *testing.T) {
}
}
func
randomData
(
size
int
)
[]
byte
{
return
bytes
.
Repeat
([]
byte
{
'x'
},
size
)
}
// Deal correctly with hard links implied by matching client inode
// numbers.
func
TestLinkExisting
(
t
*
testing
.
T
)
{
tc
:=
NewTestCase
(
t
)
defer
tc
.
Cleanup
()
c
:=
R
andomData
(
5
)
c
:=
r
andomData
(
5
)
tc
.
WriteFile
(
tc
.
orig
+
"/file1"
,
c
,
0644
)
...
...
@@ -614,27 +619,6 @@ func TestReadZero(t *testing.T) {
}
}
func
RandomData
(
size
int
)
[]
byte
{
// Make blocks that are not period on 1024 bytes, so we can
// catch errors due to misalignments.
block
:=
make
([]
byte
,
1023
)
content
:=
make
([]
byte
,
size
)
for
i
:=
range
block
{
block
[
i
]
=
byte
(
i
)
}
start
:=
0
for
start
<
len
(
content
)
{
left
:=
len
(
content
)
-
start
if
left
<
len
(
block
)
{
block
=
block
[
:
left
]
}
copy
(
content
[
start
:
],
block
)
start
+=
len
(
block
)
}
return
content
}
func
CompareSlices
(
t
*
testing
.
T
,
got
,
want
[]
byte
)
{
if
len
(
got
)
!=
len
(
want
)
{
t
.
Errorf
(
"content length: got %d want %d"
,
len
(
got
),
len
(
want
))
...
...
@@ -654,7 +638,7 @@ func TestReadLargeMemCheck(t *testing.T) {
tc
:=
NewTestCase
(
t
)
defer
tc
.
Cleanup
()
content
:=
R
andomData
(
385
*
1023
)
content
:=
r
andomData
(
385
*
1023
)
tc
.
WriteFile
(
tc
.
origFile
,
[]
byte
(
content
),
0644
)
f
,
err
:=
os
.
Open
(
tc
.
mountFile
)
...
...
@@ -689,7 +673,7 @@ func TestReadLarge(t *testing.T) {
tc
:=
NewTestCase
(
t
)
defer
tc
.
Cleanup
()
content
:=
R
andomData
(
385
*
1023
)
content
:=
r
andomData
(
385
*
1023
)
tc
.
WriteFile
(
tc
.
origFile
,
[]
byte
(
content
),
0644
)
back
,
err
:=
ioutil
.
ReadFile
(
tc
.
mountFile
)
...
...
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