-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Feature Requst: Add regex support to test filters #53278
Comments
Hello, I came to this issue while trying to run only one test in a test suite with several tests sharing the same base name. Coming from Go I wanted to run a test with However reading this comment on Cargo, I discovered the While I believe this feature request would be a plus, I recognize that the substring feature is enough for me so far. |
We could make it truly backward-compatible by introducing a cargo test -Z unstable-options --regex 'foo$' One potential issue is that this makes |
…humio Given that the humio metrics sink depends on the log_to_metric transform. Also fix Makefile to run humio integration tests. I couldn't find a good way to use a wildcard for the module (like "::humio::*::integration_tests") so I just did the logs submodule for now. It seems like there are plans to add regex support for test filters: rust-lang/rust#53278 Signed-off-by: Jesse Szwedko <[email protected]>
…humio (#4617) Given that the humio metrics sink depends on the log_to_metric transform. Also fix Makefile to run humio integration tests. I couldn't find a good way to use a wildcard for the module (like "::humio::*::integration_tests") so I just did the logs submodule for now. It seems like there are plans to add regex support for test filters: rust-lang/rust#53278 Signed-off-by: Jesse Szwedko <[email protected]>
…humio (#4617) Given that the humio metrics sink depends on the log_to_metric transform. Also fix Makefile to run humio integration tests. I couldn't find a good way to use a wildcard for the module (like "::humio::*::integration_tests") so I just did the logs submodule for now. It seems like there are plans to add regex support for test filters: rust-lang/rust#53278 Signed-off-by: Jesse Szwedko <[email protected]> Signed-off-by: Duy Do <[email protected]>
This looks like useful functionality, and I would like to take a stab at trying to implement it. Using a @kennytm You said that making @rustbot claim |
…humio (vectordotdev#4617) Given that the humio metrics sink depends on the log_to_metric transform. Also fix Makefile to run humio integration tests. I couldn't find a good way to use a wildcard for the module (like "::humio::*::integration_tests") so I just did the logs submodule for now. It seems like there are plans to add regex support for test filters: rust-lang/rust#53278 Signed-off-by: Jesse Szwedko <[email protected]> Signed-off-by: Brian Menges <[email protected]>
This is currently blocked on rust-lang/regex#476, due to the fact that |
Some more discussion has been started in this conversation. I'll update the issue when a conclusion has been reached. |
libtest itself depends on std, so it should be okay for its dependencies to depend on std. |
I think all that needs to happen on the regex side is that it needs to depend on This should probably be enabled by a |
However, adding a new dependency to the standard library is still a big deal. regex is approved for use in the compiler but that does not mean it can be used in the standard library. I am not sure what the process for that looks like. |
+1, any update for this feature? |
Proposal
I'd like to filter my tests based on a more complex pattern than just substring.
The current behavior of rust tests is that when a pattern is specified, then only tests that contain that pattern as a substring are run.
cargo test -- foo
will run only tests that contain the substringfoo
.I propose to amend this to allow for a regex syntax.
cargo test -- /regex/
which will run tests that match the regexregex
.This is "technically" a breaking change because it's possible that people are already using filters with slashes in them, but since test names can't contain slashes these invocations would always be running 0 tests.
Misc
The text was updated successfully, but these errors were encountered: