[llvm-dev] FileCheck DAG match N lines

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 27 06:31:57 PST 2019


> If a test has output of the following form:
> 
>   START
>   VALUE X1
>   VALUE X2
>   [...]
>   VALUE X_N
>   END
> 
> where the order of X_1..X_N is not deterministic, is it possible to
> write FileCheck checks that verify that the "VALUE" lines occur in any
> order, with only one occurrence per line, and no other "VALUE" lines in
> between?
> 
> One idea that was suggested to me was to write checks of the following
> form:
> 
>   CHECK: START
>   CHECK-NOT: VALUE
>   CHECK-DAG: VALUE X1
>   CHECK-DAG: VALUE X2
>   [...]
>   CHECK-DAG: VALUE X_N
>   CHECK-NOT: VALUE
>   CHECK: END

That sequence will verify there's no VALUE prior to the first
matching CHECK-DAG, or after the last matching CHECK-DAG.  It
won't look at anything between the first and last DAG match.

If VALUE doesn't occur anywhere else, it's possible that the
command-line option `-implicit-check-not` would do what you want.
Offhand I don't recall how it interacts with CHECK-DAG, though.
--paulr

> 
> However, that for example matches on:
> 
>   START
>   VALUE X1
>   VALUE X1
>   VALUE Foo
>   VALUE X3
>   VALUE X1
>   VALUE X2
>   END
> 
> I have looked through the FileCheck documentation, but haven't found
> anything that describes a similar case.
> 
> Are these sorts of checks achievable with FileCheck?
> 
> Best regards,
> David
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list