Skip to content

compiletest: error-pattern and warnings are not checked in run-pass tests #35165

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

Closed
michaelwoerister opened this issue Aug 1, 2016 · 8 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@michaelwoerister
Copy link
Member

There are some run-pass tests that seemingly check whether a specific warning or error is emitted. As far as I can tell though, the compiletest tool just ignores the given directives in a run-pass test case, i.e. changing the given directives to something unexpected still lets the tests pass.

Some affected test cases (in no particular order):

  • attr-before-view-item.rs
  • attr-before-view-item2.rs
  • deprecated-macro_escape-inner.rs
  • deprecated-macro_escape.rs
  • deriving-meta-empty-trait-list.rs
  • liveness-assign-imm-local-after-ret.rs
  • unreachable-code-1.rs
  • auxiliary/const_fn_lib.rs
  • auxiliary/issue_3136_a.rs
  • enum-size-variance.rs
  • issue-25757.rs
  • pred-not-bool.rs
  • issue-19100.rs
  • issue-2611-3.rs

cc @rust-lang/compiler @rust-lang/tools

@michaelwoerister michaelwoerister added I-wrong A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 1, 2016
@brson
Copy link
Contributor

brson commented Aug 1, 2016

Nice catch.

@brson brson added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Aug 1, 2016
@brson
Copy link
Contributor

brson commented Aug 1, 2016

An easy way to get started fixing this is to add proper checks for the warnings to run-pass. It should be relatively easy to crib off the compile-fail code to figure out how to do it.

Additionally add code that makes error directives //~ERROR or error-pattern into errors since they don't make sense in run-pass tests.

For any tests that begin to fail because of these changes, if the fix is obvious, then fix it, otherwise check with the author of those tests (or ask here) to figure out how to proceed.

@terrynsun
Copy link
Contributor

Can I try working on this?

@michaelwoerister
Copy link
Member Author

@terrynsun Absolutely!

You might want to take a look at the implementation of compiletest::runtest::run_cfail_test for clues on what to add to compiletest::runtest::run_rpass_test.

@ahmedcharles
Copy link
Contributor

I have a fix for this, I just need a few other PRs to land first.

@terrynsun
Copy link
Contributor

Cool! Sorry for taking so long to try to work on this.

@ghost
Copy link

ghost commented Dec 6, 2016

This should be closed, since the associated PR is in tree, right?

@michaelwoerister
Copy link
Member Author

@Michael-Zapata True, thanks for the reminder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants