[Lldb-commits] [lldb] r239126 - [TestChangeProcessGroup] Mark the test as xfail for Android API 16

Siva Chandra sivachandra at google.com
Thu Jun 4 17:22:49 PDT 2015


Author: sivachandra
Date: Thu Jun  4 19:22:49 2015
New Revision: 239126

URL: http://llvm.org/viewvc/llvm-project?rev=239126&view=rev
Log:
[TestChangeProcessGroup] Mark the test as xfail for Android API 16

Summary:
This change adds the infrastructure to mark tests as xfail for specific
Android API levels.

Test Plan: dotest.py TestChangeProcessGroup on an Android API 16 device.

Reviewers: chying, labath, chaoren

Reviewed By: labath, chaoren

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10261

Modified:
    lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py?rev=239126&r1=239125&r2=239126&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py (original)
+++ lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py Thu Jun  4 19:22:49 2015
@@ -26,6 +26,7 @@ class ChangeProcessGroupTestCase(TestBas
 
     @skipIfFreeBSD # Times out on FreeBSD llvm.org/pr23731
     @skipIfWindows # setpgid call does not exist on Windows
+    @expectedFailureAndroid("http://llvm.org/pr23762", api_levels=[16])
     @dwarf_test
     def test_setpgid_with_dwarf(self):
         self.buildDwarf()

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=239126&r1=239125&r2=239126&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Jun  4 19:22:49 2015
@@ -47,6 +47,11 @@ import lldbtest_config
 import lldbutil
 from _pyio import __metaclass__
 
+if sys.version_info.major < 3:
+    import urlparse
+else:
+    import urllib.parse as urlparse
+
 # dosep.py starts lots and lots of dotest instances
 # This option helps you find if two (or more) dotest instances are using the same
 # directory at the same time
@@ -429,6 +434,29 @@ def builder_module():
         return __import__("builder_freebsd")
     return __import__("builder_" + sys.platform)
 
+def run_adb_command(cmd, device_id):
+    device_id_args = []
+    if device_id:
+        device_id_args = ["-s", device_id]
+    full_cmd = ["adb"] + device_id_args + cmd
+    p = Popen(full_cmd, stdout=PIPE, stderr=PIPE)
+    stdout, stderr = p.communicate()
+    return p.returncode, stdout, stderr
+
+def android_device_api():
+    device_id = None
+    if lldb.platform_url:
+        parsed = urlparse.urlparse(lldb.platform_url)
+        if parsed.scheme == "adb":
+            device_id = parsed.hostname
+    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.")
+
 #
 # Decorators for categorizing test cases.
 #
@@ -654,10 +682,23 @@ def expectedFailureLinux(bugnumber=None,
 def expectedFailureWindows(bugnumber=None, compilers=None):
     return expectedFailureOS(['windows'], bugnumber, compilers)
 
-def expectedFailureAndroid(bugnumber=None):
+def expectedFailureAndroid(bugnumber=None, api_levels=None):
+    """ Mark a test as xfail for Android.
+
+    Arguments:
+        bugnumber - The LLVM pr associated with the problem.
+        api_levels - A sequence of numbers specifying the Android API levels
+            for which a test is expected to fail.
+    """
     def fn(self):
         triple = self.dbg.GetSelectedPlatform().GetTriple()
-        return re.match(".*-.*-.*-android", triple)
+        match = re.match(".*-.*-.*-android", triple)
+        if match:
+            if not api_levels:
+                return True
+            device_api = android_device_api()
+            return device_api and (device_api in api_levels)
+
     return expectedFailure(fn, bugnumber)
 
 def expectedFailureLLGS(bugnumber=None, compilers=None):





More information about the lldb-commits mailing list