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-prefix being a suffix of other check-prefixes in the same file #28

Closed
ythri opened this issue Jul 23, 2024 · 1 comment · Fixed by #29
Closed

check-prefix being a suffix of other check-prefixes in the same file #28

ythri opened this issue Jul 23, 2024 · 1 comment · Fixed by #29
Labels
bug Something isn't working parity Diverging from upstream FileCheck

Comments

@ythri
Copy link

ythri commented Jul 23, 2024

Hi,

here is the second issue I found, where filecheck behaves differently from the official LLVM FileCheck.

In my project, I sometimes have multiple tests in the same file, like this:

RUN: echo "1" | filecheck %s --check-prefix FIRST
FIRST: 1

RUN: echo "2" | filecheck %s --check-prefix SECOND
SECOND: 2

This works completely fine. However, once one of the check-prefixes is a suffix of another check-prefix, filecheck want to check both, while LLVM FileCheck still works correctly.

I.e., if I change the test to

RUN: echo "1" | filecheck %s --check-prefix TEST
TEST: 1

RUN: echo "2" | filecheck %s --check-prefix SECONDTEST
SECONDTEST: 2

then filecheck fails with:

$ echo "1" | filecheck test.itest --check-prefix TEST
test3.itest:5: error: Couldn't match "2".
Current position at <stdin>:1:1

^

while LLVM FileCheck correctly sees SECONDTEST as a different prefix from TEST.

This can be relevant e.g. if you have tests like "INT_TEST" and "UINT_TEST" :)

@AntonLydike
Copy link
Owner

Interesting! I had briefly considered that interaction previously, but didn't check how LLVM did it. I'll look into LLVM to see how they decide what a prefix actually is!

@AntonLydike AntonLydike added bug Something isn't working parity Diverging from upstream FileCheck labels Jul 24, 2024
AntonLydike added a commit that referenced this issue Jul 30, 2024
This PR adds the requirement that the `CHECK` be preceded by either a
new-line, or a character that is not `[A-Za-z]`. This fixes #28

It also adds diagnostic printing when checking fails inside a DAG region
by printing all currently considered input and greying out regions that
are already consumed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parity Diverging from upstream FileCheck
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants