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

TESTNAME should be in CONTRIBUTING.md #9825

Open
est31 opened this issue Nov 10, 2022 · 2 comments
Open

TESTNAME should be in CONTRIBUTING.md #9825

est31 opened this issue Nov 10, 2022 · 2 comments

Comments

@est31
Copy link
Member

est31 commented Nov 10, 2022

TESTNAME is currently underdocumented. It is mentioned in the book but the book is very long and it explains stuff like how to use git and stuff. For me, as someone coming from rustc, who was accustomed to x.py test path/to/test working, TESTNAME was quite non-obvious. It's also not suggested when compiletest prints that a test has failed:

To only update this specific test, also pass `--test-args manual_let_else.rs`

If you try that flag you get:

$ cargo uitest --test-args manual_let_else.rs
error: Found argument '--test-args' which wasn't expected, or isn't valid in this context

And:

$ cargo uitest -- --test-args manual_let_else.rs
    Finished test [unoptimized + debuginfo] target(s) in 0.18s
     Running tests/compile-test.rs (target/debug/deps/compile_test-a3c7e3c02f9d451b)
error: Unrecognized option: 'test-args'
error: test failed, to rerun pass `--test compile-test`

In #8437 , I ended up running all tests each time which wasted a lot of time. I think a mention of TESTNAME definitely belongs into CONTRIBUTING.md.

cc rust-lang/rust#104200

@blyxyas
Copy link
Member

blyxyas commented Nov 17, 2022

It is mentioned in basics.md

Building and Testing

[...]
Since Clippy's test suite is pretty big, there are some commands that only run a subset of Clippy's tests:

# only run UI tests
cargo uitest
# only run UI tests starting with `test_`
TESTNAME="test_" cargo uitest
# only run dogfood tests
cargo dev dogfood

[...]

CONTRIBUTING.md redirects you to basics.md before telling you to test the lint.

  1. Find something to fix/improve
  2. Change code (likely some file in clippy_lints/src/)
  3. Follow the instructions in the Basics docs to get set up
  4. Run cargo test in the root directory and wiggle code until it passes
  5. Open a PR (also can be done after 2. if you run into problems)

Is TESTNAME=... underdocumented? Maybe, the documentation wants you to read basics.md before adding the lint, and then visiting the book (Which also talks about TESTNAME) to learn how to add the lint. It is normal that a big project asks you to learn how that project works.

@xFrednet
Copy link
Member

Our documentation has sadly become a bit chaotic over the time. We have some people working on restructuring it and rewriting parts, but it'll probably still take a bit longer due to time limitations. I'll keep this in mind when we update this part of the documentation :)

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