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

CHECK-NEXT behavior deviating from FileCheck #37

Closed
frederik-h opened this issue Nov 7, 2024 · 1 comment · Fixed by #38
Closed

CHECK-NEXT behavior deviating from FileCheck #37

frederik-h opened this issue Nov 7, 2024 · 1 comment · Fixed by #38

Comments

@frederik-h
Copy link

I can run most tests from my testsuite that uses lit and FileCheck with FileCheck replaced by filecheck.
But I have an example input for which the behavior of filecheck deviates from the behavior of FileCheck from LLVM 17 (more concretely, the build from the Ubuntu 22.04 package).
Consider a file output with the following content

ax
x, x,
x,

and a file check-input with the following content

//CHECK: ax
//CHECK-NEXT: x,  x,
//CHECK: x,

Running cat output | FileCheck-17 input succeeds without output and with exit code 0.
With filecheck, I get this result:

$ cat output |  filecheck input
input:3: error: Couldn't match "x,".
Current position at <stdin>:3:1

^

The error goes away if I turn the CHECK-NEXT into a CHECK or if I remove a , at the end of one of the two lines (in both files).

@AntonLydike
Copy link
Owner

Very interesting find! I hadn't noticed it, but there does appear to be a bug in the whitespace matching logic! Fixing it!

AntonLydike added a commit that referenced this issue Nov 11, 2024
This fixes a bug where `x x` would be translated to `x\s+x`, which is
subtly wrong as `\s` allows newline matching. The more correct way is
`x[ \t\v]+x`, which it now is with this patch.

Fixes #37
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 a pull request may close this issue.

2 participants