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

Update TESTNAME instructions in CONTRIBUTING.md #31339

Merged
merged 4 commits into from
Feb 2, 2016
Merged

Conversation

rthomas
Copy link
Contributor

@rthomas rthomas commented Feb 1, 2016

When trying to run a specific test, I found the contributing docs a bit confusing and through a bit of googling found out that TESTNAME takes the fully qual'd name of the test.

I'm unsure if this can also take the source file, but I was unable to get that to work.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

- `make check TESTNAME=<path-to-test-file>.rs` - Run a single test file
- `make check-stage1-rpass TESTNAME=<path-to-test-file>.rs` - Run a single
- `make check TESTNAME=<name-of-test-to-run>` - Run a single test file
- `TESTNAME` should be the fully qualified name of the test function, e.g.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think that TESTNAME is basically just a string match against the name of each test. For example all of the run-pass tests are named after the basename of their files, and the libstd tests are named based on modules and such. So for example the test you mentioned below would also be matched with the filters collections, capacity, hash::map, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thanks Alex - I've been trying to find how this is matched with not much luck. The reason I wanted to make it a little clearer was when I tried with the file path as suggested I couldn't get it to work - e.g. I used TESTNAME=src/libstd/collections/hash/map.rs to try to run the tests there.

I'd like to try to find how this is implemented, so I can update the docs if it is just pattern matching as you say.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's most likely implemented in src/libtest/lib.rs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is specifically implemented here

@nagisa
Copy link
Member

nagisa commented Feb 1, 2016

This uses substring match. You can use TESTNAME=abc to run all the tests with abc in the name.

@rthomas
Copy link
Contributor Author

rthomas commented Feb 2, 2016

Thanks all, I've updated the docs again to specify substring matching.

@alexcrichton
Copy link
Member

@bors: r+ df31868 rollup

Thanks!

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Feb 2, 2016
When trying to run a specific test, I found the contributing docs a bit confusing and through a bit of googling found out that TESTNAME takes the fully qual'd name of the test.

I'm unsure if this can also take the source file, but I was unable to get that to work.
@dirk
Copy link
Contributor

dirk commented Feb 2, 2016

Should these documentation improvements also be made in make tips? Right now it doesn't really provide the helpful details that are present in CONTRIBUTING.md.

Here are the relevant testing bits currently outputted by make tips:

  * check-$(crate) - Test a crate, e.g. `check-std`
  * check-ref - Run the language reference tests
  * check-docs - Test the documentation examples
  * check-stage$(stage)-$(crate) - Test a crate in a specific stage
  * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/
  * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests

  ...

  // Modifying libstd? Use this command to run unit tests just on your change
  make check-stage1-std NO_REBUILD=1 NO_BENCH=1

  // Added a run-pass test? Use this to test running your test
  make check-stage1-rpass TESTNAME=my-shiny-new-test

  // Having trouble figuring out which test is failing? Turn off parallel tests
  make check-stage1-std RUST_TEST_THREADS=1

I'd be happy to make these updates/edits if you all think they're worth making. 😄

bors added a commit that referenced this pull request Feb 2, 2016
@bors bors merged commit df31868 into rust-lang:master Feb 2, 2016
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

Successfully merging this pull request may close these issues.

7 participants