mirror of
https://github.com/rclone/rclone
synced 2024-12-24 15:43:45 +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)
|
||||
for i := 0; i < numberOfFiles; i++ {
|
||||
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)
|
||||
totalBytes += size
|
||||
}
|
||||
@ -149,6 +152,9 @@ func commonInit() {
|
||||
default:
|
||||
source = randSource
|
||||
}
|
||||
if minFileSize > maxFileSize {
|
||||
maxFileSize = minFileSize
|
||||
}
|
||||
}
|
||||
|
||||
type zeroReader struct{}
|
||||
|
Loading…
Reference in New Issue
Block a user