This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Fix TestTargetXMLArch's expected arch
ClosedPublic

Authored by luporl on Mar 2 2018, 9:04 AM.

Details

Summary

When running on an architecture other than x86_64, the
target.ConnectRemote() part of the test may add platform information to
the target triple.

It was observed that this happens at Process::CompleteAttach() method,
after the platform_sp->IsCompatibleArchitecture() check fails.
This method then calls platform_sp->GetPlatformForArchitecture(), that
on a Linux machine ends up returning a generic Linux platform, that then
ends up getting added to the original target architecture.

Diff Detail

Repository
rL LLVM

Event Timeline

luporl created this revision.Mar 2 2018, 9:04 AM
luporl added subscribers: lbianc, alexandreyy.

+jason, as he's the one who wrote this test.

I think that for these kind of tests, we should find a way to isolate them from the host differences and make sure they run the same way everywhere.

Pavel raises a good point, but I don't know if the onerous should be on this patch author to work out a better way to test this.

The question I have is -- what is the target triple on your linux system? Is the vendor field of the triple empty? To be honest, we could test for .startswith('x86_64-') here and that's all we really need to be doing. If the host platform is "infecting" the triple with a vendor or OS, that's not what the test is intended to check.

labath added a comment.Mar 2 2018, 2:54 PM

Yeah, I didn't mean to suggest Leandro should be the one testing this. I meant "we" as a community.

If you say that checking for x86_64 is enough for this test, then maybe we can postpone that and just change the assertion, but I would like to get there eventually, as this can of a test has potential to be completely reproducible on all platforms, and it probably doesn't even take much to get there (maybe explicitly selecting a platform before creating a target, or finding a way to disable host-target fallbacks).

luporl added a comment.Mar 5 2018, 5:04 AM

Pavel raises a good point, but I don't know if the onerous should be on this patch author to work out a better way to test this.

The question I have is -- what is the target triple on your linux system? Is the vendor field of the triple empty? To be honest, we could test for .startswith('x86_64-') here and that's all we really need to be doing. If the host platform is "infecting" the triple with a vendor or OS, that's not what the test is intended to check.

The native triple on my system is powerpc64le-unknown-linux-gnu. In the test, target.GetTriple() was returning x86_64--linux.

luporl added a comment.Mar 5 2018, 5:08 AM

BTW, why is failure expected in i386?

@expectedFailureAll(archs=["i386"])

@labath, @jasonmolenda, any updates on this? Can we just change the assert for now?

labath accepted this revision.Mar 15 2018, 6:15 AM

Based on Jason's comment above, it sounds like changing the assertion is good enough.

This revision is now accepted and ready to land.Mar 15 2018, 6:15 AM

Thanks @labath. Can you check this in for me?

This revision was automatically updated to reflect the committed changes.