Skip to content

Commit

Permalink
add seeded random number for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Blyth committed Sep 19, 2024
1 parent fdc71e9 commit ff40f41
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions filesystem/fat32/testdata/fat32.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"math/rand/v2"
"math/rand"
"os"
"strconv"

Expand All @@ -13,6 +13,7 @@ import (

func main() {
filename := "test_file.img"
r := rand.New(rand.NewSource(37))
os.Remove(filename)
fs := mkfs(filename)
mkfile(fs, "/testfile")
Expand All @@ -23,7 +24,7 @@ func main() {
mkdir(fs, "/b/sub"+inc)
mkdir(fs, "/b/sub"+inc+"/blob/")
mkfile(fs, "/b/sub"+inc+"/blob/testfile1")
mkRandFile(fs, "/b/sub"+inc+"/blob/randFileSize")
mkRandFile(fs, "/b/sub"+inc+"/blob/randFileSize", r.Intn(73))
mkSmallFile(fs, "/b/sub"+inc+"/blob/testfile3")
}
mkSmallFile(fs, "/b/sub55/blob/testfile4")
Expand Down Expand Up @@ -70,14 +71,13 @@ func mkfile(fs filesystem.FileSystem, name string) {
panic(err)
}
}
func mkRandFile(fs filesystem.FileSystem, name string) {
func mkRandFile(fs filesystem.FileSystem, name string, rSize int) {
rw, err := fs.OpenFile(name, os.O_CREATE|os.O_RDWR)
if err != nil {
panic(err)
}

randSize := rand.IntN(73)
size := randSize * 1024 * 1024
size := rSize * 1024 * 1024
smallFile := make([]byte, size, size)
_, err = rw.Write(smallFile)
if err != nil {
Expand Down

0 comments on commit ff40f41

Please sign in to comment.