kusmour created this revision.
kusmour added a reviewer: xiaobai.
Herald added subscribers: lldb-commits, srhines.
Herald added a project: LLDB.

Fixed `Android.rules` for running test suite on remote android

- the build configuration is not compatible with ndk structure, change it to 
link to static libc++
- generally clang should be able to use libc++ and will link against the right 
library, but some libc++ installations require the user manually link libc++abi.
- add flag `-lc++abi` to fix the test binary build failure

Added `skipIfTargetAndroid` for better test support

- the `skipIfPlatform` method will ask `lldbplatformutil.getPlatform()` for 
platform info which is actually the os type, and *Android* is not os type but 
environment
- create this function to handle the android target condition


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64118

Files:
  
lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
  lldb/packages/Python/lldbsuite/test/decorators.py
  lldb/packages/Python/lldbsuite/test/make/Android.rules


Index: lldb/packages/Python/lldbsuite/test/make/Android.rules
===================================================================
--- lldb/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/packages/Python/lldbsuite/test/make/Android.rules
@@ -90,5 +90,6 @@
 
        ARCH_LDFLAGS += \
                -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-               
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+               
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+               -lc++abi
 endif
Index: lldb/packages/Python/lldbsuite/test/decorators.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/decorators.py
+++ lldb/packages/Python/lldbsuite/test/decorators.py
@@ -606,6 +606,10 @@
     """Decorate the item to skip tests that should be skipped on any non 
Darwin platform."""
     return skipUnlessPlatform(lldbplatformutil.getDarwinOSTriples())(func)
 
+def skipUnlessTargetAndroid(func):
+    return unittest2.skipUnless(lldbplatformutil.target_is_android(),
+                                "requires target to be Android")(func)
+
 
 def skipIfHostIncompatibleWithRemote(func):
     """Decorate the item to skip tests if binaries built on this host are 
incompatible."""
Index: 
lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
===================================================================
--- 
lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
+++ 
lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
@@ -16,7 +16,7 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessPlatform(['android'])
+    @skipUnlessTargetAndroid
     def test_cache_line_size(self):
         self.build(dictionary=self.getBuildFlags())
         exe = self.getBuildArtifact("a.out")


Index: lldb/packages/Python/lldbsuite/test/make/Android.rules
===================================================================
--- lldb/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/packages/Python/lldbsuite/test/make/Android.rules
@@ -90,5 +90,6 @@
 
 	ARCH_LDFLAGS += \
 		-L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-		$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+		$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+		-lc++abi
 endif
Index: lldb/packages/Python/lldbsuite/test/decorators.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/decorators.py
+++ lldb/packages/Python/lldbsuite/test/decorators.py
@@ -606,6 +606,10 @@
     """Decorate the item to skip tests that should be skipped on any non Darwin platform."""
     return skipUnlessPlatform(lldbplatformutil.getDarwinOSTriples())(func)
 
+def skipUnlessTargetAndroid(func):
+    return unittest2.skipUnless(lldbplatformutil.target_is_android(),
+                                "requires target to be Android")(func)
+
 
 def skipIfHostIncompatibleWithRemote(func):
     """Decorate the item to skip tests if binaries built on this host are incompatible."""
Index: lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
+++ lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
@@ -16,7 +16,7 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessPlatform(['android'])
+    @skipUnlessTargetAndroid
     def test_cache_line_size(self):
         self.build(dictionary=self.getBuildFlags())
         exe = self.getBuildArtifact("a.out")
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to