-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
implement "only-<platforms>" for test headers #47487
Changes from 1 commit
fd075c6
1e436eb
567b07c
bd70f0f
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 |
---|---|---|
|
@@ -44,6 +44,8 @@ impl EarlyProps { | |
props.ignore = | ||
props.ignore || | ||
config.parse_cfg_name_directive(ln, "ignore") || | ||
(config.parse_cfg_prefix(ln, "only") && | ||
!config.parse_cfg_name_directive(ln, "only")) || | ||
ignore_gdb(config, ln) || | ||
ignore_lldb(config, ln) || | ||
ignore_llvm(config, ln); | ||
|
@@ -564,6 +566,17 @@ impl Config { | |
} | ||
} | ||
|
||
fn parse_cfg_prefix(&self, line: &str, prefix: &str) -> bool { | ||
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. Can you rename this to something like 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. Sure. Can you point what's wrong with parsing? Thanks. 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. There's nothing wrong, just that a function returning 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. I misunderstood, I will update the function name. |
||
// returns whether this line contains this prefix or not. For prefix | ||
// "ignore", returns true if line says "ignore-x86_64", "ignore-arch", | ||
// "ignore-andorid" etc. | ||
if line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-') { | ||
true | ||
} else { | ||
false | ||
} | ||
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.
|
||
} | ||
|
||
fn parse_name_directive(&self, line: &str, directive: &str) -> bool { | ||
// Ensure the directive is a whole word. Do not match "ignore-x86" when | ||
// the line says "ignore-x86_64". | ||
|
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.
Why do we need to call
parse_cfg_prefix
here but not for ignore? What makes only special?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.
This checks is there any //only-<> specification present and if so, does it matches with current platform.
For ignore, we don't care if any other //ignore-<> exists. Like platform 'bar' won't care of //ignore- but it should care if //only- exists.
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.
Ah, that makes sense. Thanks! Can we put that into a (short) comment in the code perhaps?
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.
Sure that will be helpful. I will add that. I am also not sure what should interactions between //only-<> and //ignore-<> should result into. There can be some interesting cases there.