Feature request: filterset
using Cargo features
#2233
Closed
BatmanAoD
started this conversation in
Feature requests
Replies: 1 comment
-
Thanks for the report. I don't think this is possible at the moment, Rust doesn't provide any information around this and any kind of scanning nextest implements will likely be quite fragile. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motivation
We have integration tests that need exclusive access to a specific hardware resource. Because we only have one of this resource, we want to run those integration tests separately from building the tests, running other tests, or generating a code-coverage report.
We are currently using a specific Cargo feature to track whether or not each test requires the hardware resource (and the feature flag enables an optional dependency that actually provides access to the resource). So we are building two separate
nextest
archives, one with the feature enabled and one with the feature disabled. For the build with the feature enabled, we use--test '*'
, because currently all integration tests require the hardware. When we add integration tests that don't require the hardware, we will use#[cfg(no(<feature>))]
on those tests.We then generate coverage metrics with
llvm-cov
, and we want them to include coverage from running the tests that require the hardware.Proposal
Add a filterset function to include or exclude tests based on whether they are enabled by a specific Cargo feature. This would enable using one
nextest-archive
built with all features enabled, but using the feature to select which tests are run in which CI jobs.In its simplest form, I think this would effectively just be
features(foo)
, and would mean "all tests built by Cargo when--features foo
is provided on the command line." If possible,features()
should take a variable number of comma-delimited arguments. Limiting this to only such tests, in contrast to all other possible feature-set combinations, would presumably be much trickier to implement and, in my opinion, wouldn't be necessary, since that could equally well be accomplished (though perhaps less performantly) withfeatures(foo) and not features()
.Along with
features()
, it would make sense to also provideall_features()
.Alternatives
Solutions with one nextest-archive:
nextest
filterset.Solutions with a separate nextest-archive for each
--features
build configuration:cargo llvm-cov report
, rather than makingcargo-llvm-cov
read directly from a nextest archive.cargo-llvm-cov
to add support for reading from multiplenextest-archive
files.Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions