[llvm-dev] FileCheck DAG match N lines

David Stenberg via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 27 02:21:18 PST 2019


Hi!

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

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


More information about the llvm-dev mailing list