forked from TrueCloudLab/rclone
test makefiles: fix crash if --min-file-size <= --max-file-size
This commit is contained in:
parent
118e8e1470
commit
f583b86334
1 changed files with 7 additions and 1 deletions
|
@ -88,7 +88,10 @@ var makefilesCmd = &cobra.Command{
|
||||||
totalBytes := int64(0)
|
totalBytes := int64(0)
|
||||||
for i := 0; i < numberOfFiles; i++ {
|
for i := 0; i < numberOfFiles; i++ {
|
||||||
dir := dirs[randSource.Intn(len(dirs))]
|
dir := dirs[randSource.Intn(len(dirs))]
|
||||||
size := randSource.Int63n(int64(maxFileSize-minFileSize)) + int64(minFileSize)
|
size := int64(minFileSize)
|
||||||
|
if maxFileSize > minFileSize {
|
||||||
|
size += randSource.Int63n(int64(maxFileSize - minFileSize))
|
||||||
|
}
|
||||||
writeFile(dir, fileName(), size)
|
writeFile(dir, fileName(), size)
|
||||||
totalBytes += size
|
totalBytes += size
|
||||||
}
|
}
|
||||||
|
@ -149,6 +152,9 @@ func commonInit() {
|
||||||
default:
|
default:
|
||||||
source = randSource
|
source = randSource
|
||||||
}
|
}
|
||||||
|
if minFileSize > maxFileSize {
|
||||||
|
maxFileSize = minFileSize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type zeroReader struct{}
|
type zeroReader struct{}
|
||||||
|
|
Loading…
Add table
Reference in a new issue