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

implement "only-<platforms>" for test headers #47487

Merged
merged 4 commits into from
Jan 17, 2018
Merged

Conversation

Pulkit07
Copy link
Contributor

@Pulkit07 Pulkit07 commented Jan 16, 2018

This patch implements "only-" for tests headers using which one can
specify just the platforms on which the test should run rather than listing all
the platforms to ignore using "ignore-".

This fixes #33581 and fixes #47459.

This patch implements "only-<platforms>" for tests headers using which one can
specify just the platforms on which the test should run rather than listing all
the platforms to ignore using "ignore-<platforms>".

This is a fix for issues rust-lang#33581 and rust-lang#47459.
true
} else {
false
}
Copy link
Member

Choose a reason for hiding this comment

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

if x { true } else { false } can simply be x...

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 16, 2018
Previous patch introduced something like if x {true} else {false} which can be
simply replaced by returning x here.

Thanks to @kennytm for spotting it.
@@ -564,6 +566,13 @@ impl Config {
}
}

fn parse_cfg_prefix(&self, line: &str, prefix: &str) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

Can you rename this to something like has_cfg_prefix? It's not really parsing right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Can you point what's wrong with parsing? Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

There's nothing wrong, just that a function returning bool seems like it shouldn't be called a parse_* function since it's not actually returning the results of the parsing, so to speak. I don't feel too strongly about this but has_cfg_prefix seems clearer to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I misunderstood, I will update the function name.

@@ -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")) ||
Copy link
Member

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?

Copy link
Contributor Author

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.

  1. If there exists a //only-<> and the platform does not matches, this should be skipped
  2. If there exists a //only-<> and the platform does match, this should not be skipped

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

@Mark-Simulacrum Mark-Simulacrum self-assigned this Jan 16, 2018
@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 16, 2018
The function parse_cfg_prefix() is not really parsing. It's just checking
whether the prefix is present or not. So the new function name as suggested by
@Mark-Simulacrum is better.
@kennytm
Copy link
Member

kennytm commented Jan 17, 2018

LGTM, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2018

📌 Commit bd70f0f has been approved by kennytm

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 17, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Jan 17, 2018
implement "only-<platforms>" for test headers

This patch implements "only-<platforms>" for tests headers using which one can
specify just the platforms on which the test should run rather than listing all
the platforms to ignore using "ignore-<platforms>".

This fixes rust-lang#33581 and fixes rust-lang#47459.
kennytm added a commit to kennytm/rust that referenced this pull request Jan 17, 2018
implement "only-<platforms>" for test headers

This patch implements "only-<platforms>" for tests headers using which one can
specify just the platforms on which the test should run rather than listing all
the platforms to ignore using "ignore-<platforms>".

This fixes rust-lang#33581 and fixes rust-lang#47459.
bors added a commit that referenced this pull request Jan 17, 2018
@bors bors merged commit bd70f0f into rust-lang:master Jan 17, 2018
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 23, 2018
Document only-X test header

This was added in rust-lang#47487 without documentation.
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 23, 2018
Document only-X test header

This was added in rust-lang#47487 without documentation.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 23, 2018
Document only-X test header

This was added in rust-lang#47487 without documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
4 participants