From 6a983d601cc766f02902ffc2c725103649456bcb Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 10 Dec 2024 16:55:31 +0000 Subject: [PATCH] test makefiles: add --flat flag for making directories with many entries --- cmd/test/makefiles/makefiles.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/test/makefiles/makefiles.go b/cmd/test/makefiles/makefiles.go index 3027d78ae..957dca020 100644 --- a/cmd/test/makefiles/makefiles.go +++ b/cmd/test/makefiles/makefiles.go @@ -30,6 +30,7 @@ var ( maxFileSize = fs.SizeSuffix(100) minFileNameLength = 4 maxFileNameLength = 12 + flat = false seed = int64(1) zero = false sparse = false @@ -55,6 +56,7 @@ func init() { flags.FVarP(makefilesFlags, &maxFileSize, "max-file-size", "", "Maximum size of files to create", "") flags.IntVarP(makefilesFlags, &minFileNameLength, "min-name-length", "", minFileNameLength, "Minimum size of file names", "") flags.IntVarP(makefilesFlags, &maxFileNameLength, "max-name-length", "", maxFileNameLength, "Maximum size of file names", "") + flags.BoolVarP(makefilesFlags, &flat, "flat", "", false, "If set create all files in the root directory", "") test.Command.AddCommand(makefileCmd) makefileFlags := makefileCmd.Flags() @@ -81,6 +83,9 @@ var makefilesCmd = &cobra.Command{ commonInit() outputDirectory := args[0] directoriesToCreate = numberOfFiles / averageFilesPerDirectory + if flat { + directoriesToCreate = 0 + } averageSize := (minFileSize + maxFileSize) / 2 start := time.Now() fs.Logf(nil, "Creating %d files of average size %v in %d directories in %q.", numberOfFiles, averageSize, directoriesToCreate, outputDirectory)