Unit testing generated IR


I’ve been using llvm as part of a self-education project and I’m trying to write a simple compiler. I’m curious about the best way to go about validating the IR my compiler produces. On one hand, I can always produce a bc file and run the interpreter on it from the command line, but I’m wondering if there’s a way I can do this programmatically in unit tests. For example, is there any way to run the code in a module I’ve produced through an interpreter and see the results from a unit test (without running CreateProcess on lli)? Thanks for your time,