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

Fix compiletest so it respects warnings for run-pass. #35674

Merged
merged 1 commit into from
Aug 27, 2016
Merged

Fix compiletest so it respects warnings for run-pass. #35674

merged 1 commit into from
Aug 27, 2016

Conversation

ahmedcharles
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@ahmedcharles
Copy link
Contributor Author

Fixes #35165

@nagisa
Copy link
Member

nagisa commented Aug 15, 2016

#35165 (comment) claims that some other PRs must land before this can go in. Which PRs did you have in mind?

@@ -992,7 +997,7 @@ actual:\n\
fn check_expected_errors(&self,
expected_errors: Vec<errors::Error>,
proc_res: &ProcRes) {
if proc_res.status.success() {
if proc_res.status.success() && expected_errors.iter().any(|x| x.kind == Some(ErrorKind::Error)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we may want to thread through some more information here, this means a compile-fail test which only checked for warnings would pass if compilation succeeded, I believe.

Perhaps whether or not proc_res.status.success() should be checked could be passed in or lifted out?

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 change is technically correct, in that check_expected_errors is only called from one place before the change, run_cfail_test and it checks for compile failure explicitly.

The code currently requires a compilation failure only if there is an error comment in the file. Note, this isn't currently useful other than ensuring that run-pass tests don't require that errors happen. And in that sense, it's a short-circuit, since it would probably result in the match failing below. Though, it does catch the unlikely failure mode where the compiler reports an error but doesn't return a failure code.

@alexcrichton
Copy link
Member

Looks like tidy has an error on travis as well.

Thanks for the PR though, looks good to me!

@ahmedcharles
Copy link
Contributor Author

The tidy is fixed.

@alexcrichton
Copy link
Member

This means that we could check in a compile-fail tests with only //~ WARNING annotations, and it could pass, right?

@alexcrichton
Copy link
Member

Er, in that it would pass if the compiler succeeded to compile. I would expect all compile-fail tests to assert that the compile fails.

@ahmedcharles
Copy link
Contributor Author

The run_cfail_test function optionally calls check_expected_errors and therefore, any condition inside check_expected_errors is not used to enforce the invariant that run_cfail_test only succeeds when compilation fails. Meaning, the code works equally well before and after this change.

Since I'm having a hard time explaining this, I'll point to the relevant code: https://github.com/rust-lang/rust/blob/master/src/tools/compiletest/src/runtest.rs#L132-L136 This is what ensures that cfail tests require a compilation failure. It's the first thing that's checked after running the compiler. It won't call check_expected_errors if compilation succeeds.

@alexcrichton
Copy link
Member

Ah yep, that'd do it! So long as we have a check for a failed status code on the cfail branch that sounds good to me.

@bors: r+ ea8e0ef

@bors
Copy link
Contributor

bors commented Aug 17, 2016

⌛ Testing commit ea8e0ef with merge 6c1fd27...

bors added a commit that referenced this pull request Aug 17, 2016
Fix compiletest so it respects warnings for run-pass.
@bors
Copy link
Contributor

bors commented Aug 17, 2016

💔 Test failed - auto-win-gnu-64-opt

@ahmedcharles
Copy link
Contributor Author

I can't repro the failure locally. Is this test only run on a specific target or is it run on all targets but only fails on this one?

@ahmedcharles
Copy link
Contributor Author

@alexcrichton How do I try this again?

@alexcrichton
Copy link
Member

@bors: r+ 6961d26

Like that!

@ahmedcharles
Copy link
Contributor Author

Can I ask bors to try again or only approved reviewers?

@alexcrichton
Copy link
Member

Ah no only approved reviewers can

@bors
Copy link
Contributor

bors commented Aug 27, 2016

⌛ Testing commit 6961d26 with merge a23064a...

bors added a commit that referenced this pull request Aug 27, 2016
Fix compiletest so it respects warnings for run-pass.
@bors bors merged commit 6961d26 into rust-lang:master Aug 27, 2016
@ahmedcharles ahmedcharles deleted the rpass branch August 27, 2016 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants