[Lldb-commits] [PATCH] D42195: [lldb] Generic base for testing gdb-remote behavior

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 23 09:30:55 PST 2018


In the xcode build, yaml2obj is built as part of the llvm build stage and so gets put in the same bin directory clang builds into.  It looks like this patch expects to find yaml2obj next to the lldb executable:

def yaml2obj_executable():
    """
    Get the path to the yaml2obj executable, which can be used to create test
    object files from easy to write yaml instructions.

    Throws an Exception if the executable cannot be found.
    """
    # Tries to find yaml2obj at the same folder as the lldb
    path = os.path.join(os.path.dirname(lldbtest_config.lldbExec), "yaml2obj")
    if os.path.exists(path):
        return path
    raise Exception("yaml2obj executable not found")

For this to work in the Xcode build, you'll need to look next to the clang executable as well.  The one downside to this is that if you redirect CC to the system clang, then this test will fail since Xcode doesn't include yaml2obj.  I can't see if the testsuite knows about the location of the clang BUILD directory, but that would be the correct place to look for the Xcode build.

It also seems wrong to have the locater for yaml2obj be in a gdbremote specific test file.  This seems like a general-purpose utility not at all specific to gdb-remote testing.  That should go in lldbtest.py, shouldn't it?

Jim


> On Jan 23, 2018, at 1:59 AM, Pavel Labath <labath at google.com> wrote:
> 
> On 22 January 2018 at 22:06, Jim Ingham <jingham at apple.com> wrote:
>> 
>> 
>>> On Jan 22, 2018, at 3:10 AM, Pavel Labath via Phabricator <reviews at reviews.llvm.org> wrote:
>>> 
>>> labath added subscribers: krytarowski, jingham, davide.
>>> labath added a comment.
>>> 
>>> In https://reviews.llvm.org/D42195#982035, @owenpshaw wrote:
>>> 
>>>> - Added yaml2obj dependency.  It it okay to be an unconditional dependency?
>>> 
>>> 
>>> Yeah, it probably needs to be conditional (if(TARGET yaml2obj)), because standalone builds will not have that target. OTOH, standalone builds will probably also have an issue with finding yaml2obj. However, I don't think it should be up to you to make standalone builds work. cc'ing Kamil and Michal, as they are the ones who use those builds.
>>> 
>>> What I am not sure about is whether we need to make any changes to accomodate the XCode build. Jim, Davide: What would it take to make a test like this work from xcode?
>> 
>> Sorry, I haven't been following.  These seem like standard lldb-unittest2 type tests.  What is the difficultly of getting such a test to run from Xcode?
> 
> The special thing about this test is that it uses the yaml2obj binary
> from llvm. I'm not sure if it's really an issue (I don't have an xcode
> build around), but I see a potential problem that this may fail
> because it can't find the binary, either because it's not built, or
> it's not in the right location.



More information about the lldb-commits mailing list