-
Notifications
You must be signed in to change notification settings - Fork 5
Convert root_cause test to use Clang's built-in diagnostic verifier. #365
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
Conversation
|
Looks good. The extra diagnostic should be there. As for the diagnostic verification failure, to me it makes sense for these to cause |
Good idea. This worked (I have not yet updated the PR); it exposed a problem in another test, but I worked around it. However, is it OK for now to leave the |
|
I lean towards making the change everywhere. I suppose that could cause it to fail early on some inputs where it was previously able to continue running after the error. If that doesn't happen on the regression tests (or we can easily fix errors that arise) I say we make the change. |
|
@jackastner I made the change. As stated in the commit message, I'm not sure it makes complete sense, but I think it's harmless for now. The tests still pass. Good? |
john-h-kastner
left a comment
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.
Yeah, looks good. I agree with the concern you raise in the commit message. We'll potentially have to deal with that when we update the clangd tool.
fails. It's unclear whether (1) there are still more operations in these methods that can fail and would merit an early return and (2) these early returns could cause problems for callers such as clangd3c that want to recover. But for now, adding these early returns is better than the status quo, and the only caller we support is the 3c tool, which just exits when one of these methods returns false. This exposed a problem with the partial_checked_arr test: it ran 3c on a lit temporary file named partial_checked_arr.c.tmp, and that file extension seems to cause 3c to spew errors. Previously 3c nevertheless exited 0 and the test carried on; now 3c would exit 1. Work around this by using -output-postfix like many of our other tests. This may not be the approach we want in the long term, but we don't have the new approach ready yet.
This means we now verify the line numbers of the diagnostics for free, which would have been a pain with the existing CHECK-DAG system. - Make the 3c tool accept a -verify option analogous to that of `clang -cc1` to verify diagnostics against `// expected-warning` comments. Currently, this applies only to the rewriting phase. - Fix a few mistakes in the expected diagnostics in the root_cause test.
dc85bfb to
cf652f5
Compare
| // RUN: 3c -alltypes %s > %t | ||
| // RUN: 3c -alltypes %t | count 0 | ||
| // RUN: 3c -alltypes -output-postfix=checked %s | ||
| // RUN: 3c -alltypes %S/partial_checked_arr.checked.c -- | count 0 | ||
| // RUN: rm %S/partial_checked_arr.checked.c |
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 is a regression to when we didn't know about %t temp files. Which admittedly may have been so soon that the changes overlapped. If there's no reason for the regressions, lets leave the simpler code that doesn't create extra files if it ends prematurely.
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.
%t expanded to a filename ending in .c.tmp. For some reason, 3c doesn't like that as an input file name and spewed a bunch of errors. For now, I just changed this test to do the same thing as many of our other tests. When we have a proper solution to this problem, we can update all the tests.
I'm sorry for not giving you more time to review this.
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.
It didn't give me any errors when I committed it. Is that because of tests on a different system, or related to the changes made in this pull request?
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.
Before this pull request, when I ran the 3c command from the RUN line manually, I saw the errors, but 3c still exited 0, so the test passed, and lit doesn't seem to show the stderr of passing tests. With the changes in this pull request, 3c exited 1, so I had to do something about the test.
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 seems significant to me, maybe for more issues? One for .tmp and one for passing with errors. If 3c ever allows tests to pass that have errors in them, that's bad for everyone. Did this pull request fix all of that? The OP was concerned with a subset and then you fixed more.
I guess for now we need to remember not to pass lit temp files to 3c. I'll see if there's a good place to fit that in the temp files issue I made earlier to document future changes.
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 seems significant to me, maybe for more issues? One for
.tmpand one for passing with errors.
Agreed!
If 3c ever allows tests to pass that have errors in them, that's bad for everyone. Did this pull request fix all of that? The OP was concerned with a subset and then you fixed more.
I'm not sure, and I don't really want to spend more time researching it right now. Someone else is probably more familiar than I am with all the types of errors that can occur in 3c.
I guess for now we need to remember not to pass lit temp files to 3c. I'll see if there's a good place to fit that in the temp files issue I made earlier to document future changes.
Good. If we pass a temp file, the test will fail, and we just need to learn quickly that it is because of the temp file and not waste time debugging again.
This means we now verify the line numbers of the diagnostics for free, which would have been a pain with the existing CHECK-DAG system.
Make the 3c tool accept a -verify option analogous to that of
clang -cc1to verify diagnostics against// expected-warningcomments. Currently, this applies only to the rewriting phase.Fix a few mistakes in the expected diagnostics in the root_cause test.
Issues for special attention in code review: