[llvm-dev] Using FileCheck in unit tests

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 19 09:30:51 PDT 2018


Aditya Nandakumar via llvm-dev <llvm-dev at lists.llvm.org> writes:
> When writing MachineFunction unit tests, I find it quite tedious to
> verify correctness in C++. I would like to use FileCheck in UnitTests
> because FileCheck is extremely convenient/robust to verify
> correctness. In order to do so, I moved most of FileCheck’s
> implementation into a header (Support/FileCheck.h) and updated
> FileCheck.cpp to use this.
>
> I ran into this while writing some target agnostic Legalization code
> in GISel where it’s not possible or extremely inconvenient to use llc.
> What do others think of this? I would think there might be non GISel
> uses for FileCheck in unit tests, but I’m not sure.
>
> Here’s a quick patch for this (https://reviews.llvm.org/D48850
> <https://reviews.llvm.org/D48850>)

Vedant Kumar via llvm-dev <llvm-dev at lists.llvm.org> writes:
> + 1, I can think of a handful of tests in unittests/Transforms/Utils
> which could be simplified using FileCheck-style checks.

Sounds like there's some general consensus that this is useful, so I'll
go ahead and start reviewing the patch.

Matthias Braun via llvm-dev <llvm-dev at lists.llvm.org> writes:
> I had similar gripes with unit testing machine function stuff. I
> personally would have preferred to create more tests based on a tool
> like llc rather than pushing more on the unit test side. Anyway I
> tried to push https://reviews.llvm.org/D48850 in order to extend llc
> to be more amenable in the situations we want to test, but it
> ultimately wasn't accepted.

Looks like you put the wrong link here and I'm having trouble finding
the review you're referring to. Do you mind digging it up for me?



More information about the llvm-dev mailing list