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

language/bad_initializer2_negative_test #14880

Closed
scheglov opened this issue Nov 6, 2013 · 5 comments
Closed

language/bad_initializer2_negative_test #14880

scheglov opened this issue Nov 6, 2013 · 5 comments
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@scheglov
Copy link
Contributor

scheglov commented Nov 6, 2013

I don't understand this.
Analyzer (is going to) reports the compile-time error, test is negative and fails with "Expected: Pass"?

FAILED: dartanalyzer-none release_ia32 language/bad_initializer2_negative_test
Expected: Pass
Actual: CompileTimeError
CommandOutput[dartanalyzer]:

stderr:
ERROR|COMPILE_TIME_ERROR|REFERENCED_BEFORE_DECLARATION|/Users/scheglov/Source/Dart/dart/tests/language/bad_initializer2_negative_test.dart|14|19|3|Local variables cannot be referenced before they are declared

Command[dartanalyzer]: sdk/bin/dartanalyzer_developer --ignore-unrecognized-flags --show-package-warnings --package-root=xcodebuild/ReleaseIA32/packages/ --machine --no-hints /Users/scheglov/Source/Dart/dart/tests/language/bad_initializer2_negative_test.dart
Took 0:00:00.032000

Short reproduction command (experimental):
    python tools/test.py -mrelease -cdartanalyzer -rnone -t240 language/bad_initializer2_negative_test

@mkustermann
Copy link
Member

Negative tests are broken by design.

The issue with negative tests is that test.py doesn't know if they are supposed to result in a compile-time error, runtime-error, checked-error, etc.

It is not possible to say if the analyzer is expected to print errors/warnings on a negative test or not. Consider the following negative test:

  tests/language/foobar_negative_test.dart
  main() {
    var x = null;
    x.foo();
  }

In that case, the none-vm and dart2js-d8 configurations will result in a runtime error, but the analyzer doesn't print errors/warnings and that's fine.

Because it's not possible to determine what the analyzer is expected to do on a negative test, we ignore the fact that it is a negative test and treat it as a normal test (i.e. for --compiler=dartanalyzer).


cc @ricowind.
Set owner to @mkustermann.
Added Invalid label.

@scheglov
Copy link
Contributor Author

scheglov commented Nov 7, 2013

Reopening as a test problem.


cc @mkustermann.
cc @peter-ahe-google.
cc @kasperl.
Removed the owner.
Removed Area-Tools label.
Added Area-Test, Triaged labels.

@scheglov scheglov added Type-Defect area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). labels Nov 7, 2013
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
@whesse
Copy link
Member

whesse commented Feb 7, 2017

@whesse whesse closed this as completed Feb 7, 2017
@whesse whesse reopened this Feb 7, 2017
@peter-ahe-google
Copy link
Contributor

If a negative test is causing problems, I normally try to identify the original author and send them a CL to convert it to a multi-test. In multi-tests you can add information about how the test should fail.

@whesse
Copy link
Member

whesse commented Feb 8, 2017

Apologies - I just wanted to make the comment in here, about negative tests not working with analyze-only runs, available to the people working on the new issue #28664, which I could have done better by putting this issue number there. This particular issue can remain closed.

The current status of this issue is that the negative tests bad_initializer[1,2]_negative_test are marked as failing in all the status files for analyzer-only or compiler runs. Those lines should have this issue number added. Only if we decide that these failure lines in the status files are unacceptable, would we need to rewrite these as multitests.

@whesse whesse closed this as completed Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants