Stephen Lin
2013-Apr-25 03:05 UTC
[LLVMdev] Minor FileCheck proposal: CHECK-UNIQUE for labels to improve error messages
Hi, Apologies if this has been proposed before; I couldn't find anything in basic searching. I've been writing tests lately and noticed that the error messages are not very helpful in cases where a check is incorrect but matches something that occurs in a later block: the checker continues assuming that the matched line is correct (no matter how much farther ahead it occurs) and then provides a misleading error message some time later. The problem is exacerbated if many similar tests are put in one file, since many checks can end up succeeding with unintended matches before something ends up failing. I propose a simple addition to FileCheck syntax to improve error messages in this case: a CHECK-UNIQUE directive which indicates that a given check is a unique match that should only occur once (and only once) in a given file and can only be matched with the given CHECK-UNIQUE; this would be used for labels or any other unique identifier lines. The CHECK-UNIQUE lines can then allow a better error message to be produced, by basically treating each section between CHECK-UNIQUE lines separately, so the actual line causing the error can be pinpointed more accurately. Anyone else thing this is a good idea? I'm happy to work on this if so. -Stephen
Eli Bendersky
2013-Apr-25 14:37 UTC
[LLVMdev] Minor FileCheck proposal: CHECK-UNIQUE for labels to improve error messages
On Wed, Apr 24, 2013 at 8:05 PM, Stephen Lin <swlin at post.harvard.edu> wrote:> Hi, > > Apologies if this has been proposed before; I couldn't find anything > in basic searching. > > I've been writing tests lately and noticed that the error messages are > not very helpful in cases where a check is incorrect but matches > something that occurs in a later block: the checker continues assuming > that the matched line is correct (no matter how much farther ahead it > occurs) and then provides a misleading error message some time later. > > The problem is exacerbated if many similar tests are put in one file, > since many checks can end up succeeding with unintended matches before > something ends up failing. > > I propose a simple addition to FileCheck syntax to improve error > messages in this case: a CHECK-UNIQUE directive which indicates that a > given check is a unique match that should only occur once (and only > once) in a given file and can only be matched with the given > CHECK-UNIQUE; this would be used for labels or any other unique > identifier lines. > > The CHECK-UNIQUE lines can then allow a better error message to be > produced, by basically treating each section between CHECK-UNIQUE > lines separately, so the actual line causing the error can be > pinpointed more accurately. > > Anyone else thing this is a good idea? I'm happy to work on this if so. >I like this idea. There are many places in the test cases where this idiom is needed and currently CHECK followed by a CHECK-NOT is used, which is cumbersome. Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130425/dbaa5056/attachment.html>
Apparently Analagous Threads
- [LLVMdev] Bikeshedding a name for new directive: CHECK-LABEL vs. CHECK-BOUNDARY vs. something else.
- [LLVMdev] [RFC] Switching make check to use 'set -o pipefail'
- FileCheck --allow-empty
- [LLVMdev] [RFC] Switching make check to use 'set -o pipefail'
- [LLVMdev] Docs question: legality of inspecting other functions in a function pass