#testing #testing-cargo #cargo #cargo-command #cargo-subcommand #cargo-toml

bin+lib cargo-test-all

Cargo 扩展,用于运行依赖项的测试

4 个版本

0.2.0 2022年5月14日
0.1.2 2020年2月12日
0.1.1 2020年2月12日
0.1.0 2020年1月15日

Cargo 插件 中排名 #376

BSD-3-Clause 许可协议

26KB
624

cargo-test-all

Cargo 扩展,用于运行依赖项的测试

功能

  • 运行 Cargo.toml 中指定的每个依赖项的测试
  • 只能指定特定的 crate 进行测试
  • 有机会运行多个线程/工作线程来构建和测试 crate

安装

在终端或 shell 中使用以下命令安装此可执行文件:

  • 安装 cargo-clone
cargo install cargo-clone
  • 安装此扩展本身
cargo install cargo-test-all

用法

在任何 Cargo 项目顶部使用 cargo test-all 调用。

Cargo extension for running tests of the used dependencies

USAGE:
    cargo-test-all [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --only <only>          List of certain crates for testing, separated by comma.
    -t, --threads <threads>    An amount of concurrent threads for testing crates. [default: 1]

工作原理

由于 Cargo 目前没有提供(据我所知)任何安装带有其自己的测试的依赖项的方式,因此它以以下方式工作:

  1. 从给定输出中确定哪些 crate 需要测试。
  2. 创建 target/testing/deps 目录,该目录将用于存储从 Crates.io 或 Git 下载的 crate。
  3. 对于每个 crate
    1. 从默认存储或通过 Git(如果不是本地)下载 crate。
    2. 移动到代码文件夹
    3. 构建源并作为任务运行测试,由工作线程执行
    4. 完成任务的输出存储在主线程中,并在完成后打印它们。

依赖项

~67MB
~1.5M SLoC