Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--recursive to test an entire workspace? #36

Closed
matthiaskrgr opened this issue Feb 14, 2022 · 9 comments
Closed

--recursive to test an entire workspace? #36

matthiaskrgr opened this issue Feb 14, 2022 · 9 comments

Comments

@matthiaskrgr
Copy link

Hi, first of all awesome crate! :D
On just a dual core system it seems to be 10-15% faster than default cargo test. :)

While playing around with it, I wondered if it would be useful to have some kind of --recursive flag that does not only run test in the current directory but also on all other crates of the current workspace.

@epage
Copy link
Contributor

epage commented Feb 14, 2022

Isn't this handed via --workspace?

@sunshowers
Copy link
Member

Thanks for the report! I'm glad that even a dual core system is faster.

As @epage says, this is handled by --workspace. nextest just forwards the build command to cargo test --no-run, so the package selection is identical to cargo test.

@matthiaskrgr
Copy link
Author

matthiaskrgr commented Feb 14, 2022

Hmm.
I was playing around in the clippy repo.
When I cd clippy_lints ; cargo test, it runs tests and doctests that are not executed with either cargo test or cargo test --workspace, I guess this means that this crate that happens to be in the same git repo is not part of the workspace..?

The idea was to have --recursive run these tests as well.

It also looks like cargo nextest run skips the doctests?
Edit: ^ seems to be #16

@sunshowers
Copy link
Member

Yes, unfortunately doctests aren't yet supported because of limitations in stable Rust. Going to mark this as closed for now as a result. Thanks again for reporting the issue!

@matthiaskrgr
Copy link
Author

Well I would like --recursive to do something like:
find all projects (cargo.tomls) that are either in the current workspace or in a subdirectory,
run cargo nextest on all of these (in parallel).

This does not seem to be what --workspace does because it requires that I actually have configured a workspace in my Cargo.toml.
--recursive should just find all the crates on its own imo (if that's possible) :)

@matthiaskrgr
Copy link
Author

Ok I see, I shouldn't have used the work "workspace" in the title, I ment like a "hierarchy of crates and subcrates in a directory" and not an official cargo workspace.

@epage
Copy link
Contributor

epage commented Feb 15, 2022

Is there a reason you aren't using a workspace? That is generally cargo's approach to working on a group of crates ("generally" because in some cases, path dependencies are relied on instead, mostly due to the lack of "workspaces in workspaces' support).

Without it, other means would be needed to opt crates in and out of each run command. It also becomes less clear what to do with -p and --exclude.

@matthiaskrgr
Copy link
Author

I think workspaces only make sense if the crates directly depend on each other and live in the same repo?
In case of clippy for example, there are a couple of libraries in the repo but also a bunch of dev tools for blessing tests for example. The tools mostly stand alone (do not depend on any of the other crates) but may still have their own tests.

For convenience it would be great if there was some simple "run all tests" command.

In CI for example we currently cd into each subproject "by hand" and run cargo test or so.
It would also solve the hassle of adding another tool but then forgetting to actually run its tests on ci (since -r would take care of that automatically)

@epage
Copy link
Contributor

epage commented Feb 15, 2022

The bigger problem for clippy is that I'm assuming its like cargo and can't have a workspace because its pulled into the rust workspace via submodules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants