Hi all,
I’ve been working for some time on the Eclair compiler (written in Haskell) and I am now at the point where I need to test the LLVM IR my compiler is generating.
How would you approach testing this generated code? I can’t seem to think of a straight-forward way of doing this. The best way I can think of is to:
- Generate the LLVM IR
- Compile it with clang to object code and link it with a C test harness (yikes)
- Invoke that C test program in Haskell via tasty/hspec
… but this seems like an awful lot of setup?
I’m also considering writing a Haskell test harness (using FFI), but I fear that might result in a cabal file with a massive amount of test executables (I need to test a lot of separate things in the runtime)?
I’m wondering how others would solve this problem?