This is an archive of the discontinued LLVM Phabricator instance.

[lldbtest] Use netloc instead of hostname to look up Android device ID.
ClosedPublic

Authored by sivachandra on Jun 5 2015, 10:17 AM.

Details

Summary

urlparse.ParseResult.hostname has only lowercase characters even if the
input URL had uppercase characters. Since Android device IDs can have
uppercase characters as well, use urlparse.ParseResult.netloc instead
and extract the device ID from it.

This change also improves the error message when lookup of the Android
device's API fails.

Diff Detail

Event Timeline

sivachandra retitled this revision from to [lldbtest] Do not use urlparse to get the Android device "hostname".
sivachandra updated this object.
sivachandra edited the test plan for this revision. (Show Details)
sivachandra added a reviewer: chaoren.
sivachandra added a subscriber: Unknown Object (MLST).
chaoren added inline comments.Jun 5 2015, 10:27 AM
test/lldbtest.py
449–451

lldb.platform_url.startswith?

450

I would prefer if we delegated as much parsing as possible to urlparse.
We can check parsed.scheme and use parsed.netloc.split(':')[0] as hostname.

chaoren added inline comments.Jun 5 2015, 10:31 AM
test/lldbtest.py
448

I don't think it's possible to not have a platform url here. Return false if not lldb.platform_url?

sivachandra retitled this revision from [lldbtest] Do not use urlparse to get the Android device "hostname" to [lldbtest] Use netloc instead of hostname to look up Android device ID..Jun 5 2015, 11:03 AM
sivachandra updated this object.
sivachandra updated this object.

Address comments.

chaoren accepted this revision.Jun 5 2015, 11:08 AM
chaoren edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 5 2015, 11:08 AM
sivachandra closed this revision.Jun 5 2015, 11:11 AM