diff --git a/filesystem/fat32/testdata/fat32.go b/filesystem/fat32/testdata/fat32.go index 01422e31..ec404e60 100644 --- a/filesystem/fat32/testdata/fat32.go +++ b/filesystem/fat32/testdata/fat32.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "math/rand/v2" + "math/rand" "os" "strconv" @@ -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") @@ -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") @@ -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 {