Skip to content

Run unit tests by passing a file path #86421

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

Closed
JohnTitor opened this issue Jun 18, 2021 · 6 comments
Closed

Run unit tests by passing a file path #86421

JohnTitor opened this issue Jun 18, 2021 · 6 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@JohnTitor
Copy link
Member

JohnTitor commented Jun 18, 2021

Currently, we have to invoke the following to run specific unit tests:

./x.py test compiler/rustc_data_structures/ --test-args thin_vec

This isn't straightforward, it'd be great if we could do with:

./x.py test compiler/rustc_data_structures/src/thin_vec/tests.rs

But unfortunately, it fails currently:

thread 'main' panicked at 'error: no rules matched compiler/rustc_data_structures/src/thin_vec/tests.rs', src/bootstrap/builder.rs:225:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

meta

This happens on b17d9c1.

(This was originally reported on rust-lang/rustc-dev-guide#1138)

@JohnTitor JohnTitor added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 18, 2021
@fee1-dead
Copy link
Member

I would like to work on this.

@rustbot claim

@asquared31415
Copy link
Contributor

Curiously, passing a file like ./x.py test ./src/test/blah/file.rs only recently started working for me, and never used to work. The only difference I see in what you have as an example is the leading ./ in the test path, however it also works to omit that for me like ./x.py test src/test/blah/file.rs

I understand "it works for me" is incredibly unhelpful, so if anyone can think of ways to try and narrow down why it only sometimes works for some people, I would be happy to assist in testing things. I am on a x86_64 linux system, and it is definitely working at commit 9fef8d9 (June 16, 2021) which is before the commit in the issue here. However the original issue was reported 14 days ago. I highly doubt that something fixed and then re-broke the test runner, so I imagine it's something setup-dependent.

@fee1-dead
Copy link
Member

@asquared31415 src/test/* stuff are suites and unlike normal unit tests on crates. I believe that is what makes the difference.

@asquared31415
Copy link
Contributor

Ohhhh my bad, I misinterpreted

@fee1-dead
Copy link
Member

fee1-dead commented Jun 19, 2021

I have made a pull request that makes it accept a file path but runs all tests in that crate. I could not figure out how to test only the path/file specified.

@rustbot release-assignment

@Mark-Simulacrum
Copy link
Member

As mentioned in #86459 (comment), I'm going to go ahead and close this issue -- I don't think this is something we want to track as rustbuild work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants