mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 02:14:42 +01:00
test makefiles: fix crash if --min-file-size <= --max-file-size
This commit is contained in:
parent
118e8e1470
commit
f583b86334
@ -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…
Reference in New Issue
Block a user