#file-tree #fuzz #tool #directory-structure #data-file #file

nightly bin+lib ftzz

文件树模糊测试器创建一个填充了一定数量文件的伪随机目录层次结构

19 个版本 (稳定)

3.0.0 2024 年 4 月 9 日
2.0.3 2023 年 10 月 9 日
2.0.2 2023 年 9 月 22 日
2.0.1 2023 年 6 月 28 日
0.1.5 2021 年 11 月 24 日

#869 in 测试

Download history 7/week @ 2024-05-16 5/week @ 2024-05-23 3/week @ 2024-05-30 7/week @ 2024-06-06 6/week @ 2024-06-13 15/week @ 2024-06-20 17/week @ 2024-06-27 46/week @ 2024-07-04 3/week @ 2024-07-11 4/week @ 2024-07-18 29/week @ 2024-07-25 14/week @ 2024-08-01 6/week @ 2024-08-08

每月下载 54
用于 2 crates

Apache-2.0

3.5MB
2K SLoC

FTZZ

文件树模糊测试器创建一个填充了一定数量文件的伪随机目录层次结构。

安装

使用预构建的二进制文件

发布页面 上提供多个平台的二进制文件。

从源代码构建

$ cargo +nightly install ftzz

要安装 cargo,请遵循 这些说明

用法

在当前目录中生成具有 大约 1 百万文件的可重复随机树

$ ftzz ./simple -n 1M
About 1,000,000 files will be generated in approximately 1,000 directories distributed across a tree of maximum depth 5 where each directory contains approximately 4 other directories.
Created 1,003,229 files across 1,259 directories.

生成 确切 1 百万文件

$ ftzz ./exact -en 1M
Exactly 1,000,000 files will be generated in approximately 1,000 directories distributed across a tree of maximum depth 5 where each directory contains approximately 4 other directories.
Created 1,000,000 files across 1,259 directories.

生成约 10,000 个文件,其中包含约 1 MB 的随机数据

$ ftzz ./with_data -n 10K -b 1M
About 10,000 files will be generated in approximately 1,000 directories distributed across a tree of maximum depth 5 where each directory contains approximately 4 other directories. Each file will contain approximately 100 bytes of random data.
Created 9,312 files (924.6 KB) across 1,570 directories.

由于 FTZZ 创建可重复的结果,因此给定相同的输入,生成的目录结构始终相同。要生成具有相同参数的结构变体,请更改起始种子

$ ftzz ./unseeded -n 100
About 100 files will be generated in approximately 100 directories distributed across a tree of maximum depth 5 where each directory contains approximately 3 other directories.
Created 45 files across 198 directories.

$ ftzz ./seeded -n 100 --seed 42 # Or $RANDOM
About 100 files will be generated in approximately 100 directories distributed across a tree of maximum depth 5 where each directory contains approximately 3 other directories.
Created 83 files across 110 directories.

其他参数可以在内置文档中找到

$ ftzz --help
Generate a random directory hierarchy with some number of files

A pseudo-random directory hierarchy will be generated (seeded by this command's input parameters)
containing approximately the target number of files. The exact configuration of files and
directories in the hierarchy is probabilistically determined to mostly match the specified
parameters.

Generated files and directories are named using monotonically increasing numbers, where files are
named `n` and directories are named `n.dir` for a given natural number `n`.

By default, generated files are empty, but random data can be used as the file contents with the
`total-bytes` option.

Usage: ftzz[EXE] [OPTIONS] --files <NUM_FILES> <ROOT_DIR>

Arguments:
  <ROOT_DIR>
          The directory in which to generate files
          
          The directory will be created if it does not exist.

Options:
  -n, --files <NUM_FILES>
          The number of files to generate
          
          Note: this value is probabilistically respected, meaning any number of files may be
          generated so long as we attempt to get close to N.

      --files-exact
          Whether or not to generate exactly N files

  -b, --total-bytes <NUM_BYTES>
          The total amount of random data to be distributed across the generated files
          
          Note: this value is probabilistically respected, meaning any amount of data may be
          generated so long as we attempt to get close to N.
          
          [default: 0]

      --fill-byte <FILL_BYTE>
          Specify a specific fill byte to be used instead of deterministically random data
          
          This can be used to improve compression ratios of the generated files.

      --bytes-exact
          Whether or not to generate exactly N bytes

  -e, --exact
          Whether or not to generate exactly N files and bytes

  -d, --max-depth <MAX_DEPTH>
          The maximum directory tree depth
          
          [default: 5]

  -r, --ftd-ratio <FILE_TO_DIR_RATIO>
          The number of files to generate per directory (default: files / 1000)
          
          Note: this value is probabilistically respected, meaning not all directories will have N
          files).

      --seed <SEED>
          Change the PRNG's starting seed
          
          For example, you can use bash's `$RANDOM` function.
          
          [default: 0]

  -h, --help
          Print help (use `-h` for a summary)

  -q, --quiet...
          Decrease logging verbosity

  -v, --verbose...
          Increase logging verbosity

  -V, --version
          Print version

依赖关系

~7–40MB
~580K SLoC