Skip to content

Filter and build integration tests needed only #8282

@pickfire

Description

@pickfire

Describe the problem you are trying to solve

There is a project with 20+ integration tests, it takes like few minutes to build all of them. Even with a small change in one of the tests file and I wanted to just run one of the tests file, I did cargo tests part_a but it still compiles everything again.

The solution right now,

  1. rm tests/*
  2. git restore tests/part_a.rs
  3. cargo test part_a, try rebuilding
  4. git restore src/dep.rs, add some dependencies needed

Essentially, this will also remove the issue of clogging the screen with 0 tests run and the need to scroll up multiple times to search for the tests run #4324.

Describe the solution you'd like

Search for the functions used in the filter (cargo test <filter>), build and run only those files needed. Something like ripgrep for function name, but this requires cargo to include the dependencies too.

This provides 2 benefits, reducing the need to build unneeded files and prevent clogging the screen by running file without tests matching the filter.

Notes

I would like to take on this issue if the complexity is not high or if there are people willing to mentor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`E-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions