[Lldb-commits] [lldb] r239173 - [lldbtest] Use netloc instead of hostname to look up Android device ID.
Siva Chandra
sivachandra at google.com
Fri Jun 5 11:07:10 PDT 2015
Author: sivachandra
Date: Fri Jun 5 13:07:10 2015
New Revision: 239173
URL: http://llvm.org/viewvc/llvm-project?rev=239173&view=rev
Log:
[lldbtest] Use netloc instead of hostname to look up Android device ID.
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.
Reviewers: chaoren
Reviewed By: chaoren
Subscribers: tberghammer, lldb-commits
Differential Revision: http://reviews.llvm.org/D10278
Modified:
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=239173&r1=239172&r2=239173&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Jun 5 13:07:10 2015
@@ -444,18 +444,20 @@ def run_adb_command(cmd, device_id):
return p.returncode, stdout, stderr
def android_device_api():
+ assert lldb.platform_url is not None
device_id = None
- if lldb.platform_url:
- parsed = urlparse.urlparse(lldb.platform_url)
- if parsed.scheme == "adb":
- device_id = parsed.hostname
+ parsed_url = urlparse.urlparse(lldb.platform_url)
+ if parsed_url.scheme == "adb":
+ device_id = parsed_url.netloc.split(":")[0]
retcode, stdout, stderr = run_adb_command(
["shell", "getprop", "ro.build.version.sdk"], device_id)
if retcode == 0:
return int(stdout)
else:
raise LookupError(
- "Unable to determine the API level of the Android device.")
+ ">>> Unable to determine the API level of the Android device.\n"
+ ">>> stdout:\n%s\n"
+ ">>> stderr:\n%s\n" % (stdout, stderr))
#
# Decorators for categorizing test cases.
More information about the lldb-commits
mailing list