-
Notifications
You must be signed in to change notification settings - Fork 20
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
Consider feature dependencies in test matrix #52
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ pub fn fetch_feature_sets(package: &crate::cargo_metadata::Package) -> Vec<Featu | |
let max_combination_size = package.max_combination_size.unwrap_or(features.len()); | ||
for n in 0..=max_combination_size { | ||
'outer: for feature_set in features.iter().combinations(n) { | ||
let feature_set: Vec<_> = feature_set | ||
let feature_set: HashSet<_> = feature_set | ||
.into_iter() | ||
.chain(package.always_include_features.iter()) | ||
.collect(); | ||
|
@@ -87,6 +87,21 @@ pub fn fetch_feature_sets(package: &crate::cargo_metadata::Package) -> Vec<Featu | |
// skip_feature_set matches: do not add it to feature_sets | ||
continue 'outer; | ||
} | ||
for feat in feature_set.clone() { | ||
for dep in package | ||
.feature_map | ||
.get(&feat.0) | ||
.unwrap_or(&FeatureList::default()) | ||
.iter() | ||
{ | ||
if dep.strip_prefix("dep:").is_some() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that this won't work for old-style implicit dependency features but we haven't been careful about that in this tool anyway There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same mechanism is used in line 22. So I would leave this as is, and an issue could be opened discussing this further. I have no knowledge about the old-style you are referring to, so I personally would not open that issue ;) |
||
continue; | ||
} | ||
if !feature_set.contains(&dep) { | ||
continue 'outer; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: it would be nice if these skipped feature combos were still included in the output at the bottom, with an explanation of which run they are equivalent to. unsure if that's going to be really annoying to do properly, could be fine with "skipped covered feature set [...] due to dependency from .. to .." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at my follow-up work regarding the rule abstraction, those dependencies would be encoded with the same rule mechanism as other selection rules, e.g. skip_feature_sets, denylists etc. What you are probably thinking of is helping users understand all the rules applied to the feature set selection and help "debugging" those rules. Probably, this workflow is started by recognizing a specific feature set is not run while the dev does not understand why it is skipped. So the dev wants to "ask" why a certain feature set was skipped. We could provide a CLI flag, taking a feature set as argument value, and we print all the conflicting rules to the screen, if it is skipped. I think this would be an easy and nice addition to the tool, but I would like to implement it on top of the rule abstraction, because as of now, this would be quite tedious handling every "rule" case separately. What do you think @Manishearth? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's fine, also this was a "thought"; I wasn't requiring this of this PR. I'm also not sure we should print every skipped set. |
||
} | ||
} | ||
} | ||
feature_sets.push(feature_set.into_iter().cloned().collect()); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't have to clone here, we're not mutating. borrow it