Hey Sean!
Yeah I’ve got a gtest subproject in lldb now. It’s not wired into any main test process (i.e. check-lldb or test targets don’t run it, but if you run the “gtest” project in the lldb workspace in Xcode, or go to the gtest dir and run “do-gtest.py”, you’ll get it running).
I’ve got it rigged up to put Xcode error markers at the point in gtests that fail at the failing assertion point after doing some output munging to make it work.
The actual gtest build/runner works on MacOSX and Linux. It should work on all platforms since I’m actually using the llvm-embedded gtest framework, so technically if llvm builds, so should the gtest setup.
However, I do some weak (and need to be improved) inference of directory structure/build structure to find some necessary files in the gtest/make/Makefile.rules. They can be overridden by environment or make variable settings, but they’re definitely not going to work for everyone and there are probably more robust methods for figuring out certain directory locations.
I run it fine on MacOSX with the canonical Xcode directory layout and using the Xcode Preferences | Locations set to put project output in a project-relative DerivedData directory.
On Linux, I assume the build directory is a sibling directory to a llvm, llvm/tools/clang, llvm/tools/lldb directory structure and (here’s the not-reasonable-default) I assume the build directory is called build-debug. (So, I have a build-drectory alongside the top-level llvm directory). Again, all these can be overridden by environment variable/make variable settings, and I think I have the Makefile emit an error if it can’t resolve the directories it uses and tells what variable to override to fix it. But, likely it needs some love.
For me, the source/Plugins/Process/Linux/ThreadStateCoordinator.{h/cpp} was my guinea pig. I’m using that to replace some guts in the llgs signal state transition logic that requires putting threads through some ptrace state magic before it should tell lldb about some thread stops. And so I’m testing that all the deferred callbacks (i.e. essentially GCD-like constructs) fire off in the right circumstances. That’s an example of a small piece of code in C++ that I just need to know is working right and so I introduced the gtest framework around it.
Hope that gets you started! Feel free to improve and/or offer suggestions.
For now, we had settled on using gtest/unittest as the root of 1-1 correspondence directory structure mirroring for testing single classes.
If we want to do collaboration tests (integration tests, etc.), we’re probably into the “should be in python category”, but we might have a few low-level multi-class testing scenarios where we might want a different gtest/functional, gtest/integration or something similar directory structure to handle those. Would be good to have discussion around that if we find a valid use for it.
-Todd