Skip to content

TESTNAME should be in CONTRIBUTING.md #9825

Open

Description

@est31

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

Activity

  1. blyxyas commented on Nov 17, 2022

    @blyxyas
    Member

    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.

  2. xFrednet commented on Nov 17, 2022

    @xFrednet
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documentationArea: Adding or improving documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions