[Lldb-commits] [PATCH] D31129: Remove remaining platform specific code from FileSpec

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 21 05:22:45 PDT 2017

labath added a comment.

In https://reviews.llvm.org/D31129#705597, @zturner wrote:

> See what you think about this.  I've created a folder called `Mocks` under `Utility`, and created a new target out of it.  `UtilityTests` links against it, and so does `InterpreterTests`.  To do this I had to add the lldb project root as an include directory, this way you can write `#include "unittests/Utility/Mocks/MockTildeExpressionResolver.h"`.  Another possibility would be to create `lldb/unittests/Mocks/Mocks/Utility`, and then add `lldb/unittests/Mocks` as an include folder.  This way you could write `#include "Mocks/Utility/MockTildeExpressionResolver.h"`.  I don't have a strong preference either way.
> I explicitly chose NOT to make one single target for all mocks (although there is only one right now obviously), because then you would have `UtilityTests` bringing in mocks from projects it doesn't depend on, and thus it would link against those projects as well, breaking the library layering.

It's not exactly the pinnacle of elegance, but I think this is better (and I don't know how I would improve it). The only thing I am not sure about is the `Mocks` folder name. I am thinking that we may run into the situation where we have some other test-only code we want to share, but it is not strictly a "mock". The only function that comes to mind right now is the `CreateConnectedSockets` from SocketTest.cpp -- I could have to reused this in gdb-remote tests, although I eventually opted for reimplementing it, as I could make it a lot simpler for this special case. (Although in this case it may have made sense to add a function like that to the regular codebase). I don't really have a good suggestion for a name though, so maybe we can leave this until a real case for it comes up.


More information about the lldb-commits mailing list