[Lldb-commits] [lldb] r365561 - [lldb_test_suite] Fix lldb test suite targeting remote Android

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 9 14:35:58 PDT 2019


Author: xiaobai
Date: Tue Jul  9 14:35:58 2019
New Revision: 365561

URL: http://llvm.org/viewvc/llvm-project?rev=365561&view=rev
Log:
[lldb_test_suite] Fix lldb test suite targeting remote Android

Summary:
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` `skipUnlessTargetAndroid` 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

**To Run Test on Remote Android**
1 start lldb-server on your devices
2 run lldb-dotest with following configuration:
`./lldb-dotest --out-of-tree-debugserver --arch aarch64 --platform-name remote-android --platform-url connect://localhost:12345 --platform-working-dir /data/local/tmp/ --compiler your/ndk/clang`

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: labath, javed.absar, kristof.beyls, srhines, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64118

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py?rev=365561&r1=365560&r2=365561&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py Tue Jul  9 14:35:58 2019
@@ -16,7 +16,7 @@ class DefaultCacheLineSizeTestCase(TestB
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipUnlessPlatform(['android'])
+    @skipUnlessTargetAndroid
     def test_cache_line_size(self):
         self.build(dictionary=self.getBuildFlags())
         exe = self.getBuildArtifact("a.out")

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=365561&r1=365560&r2=365561&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Tue Jul  9 14:35:58 2019
@@ -596,6 +596,10 @@ def skipIfWindows(func):
     """Decorate the item to skip tests that should be skipped on Windows."""
     return skipIfPlatform(["windows"])(func)
 
+def skipIfTargetAndroid(func):
+    return unittest2.skipIf(lldbplatformutil.target_is_android(),
+                                "skip on target Android")(func)
+
 
 def skipUnlessWindows(func):
     """Decorate the item to skip tests that should be skipped on any non-Windows platform."""
@@ -606,6 +610,10 @@ def skipUnlessDarwin(func):
     """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."""

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=365561&r1=365560&r2=365561&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Tue Jul  9 14:35:58 2019
@@ -90,5 +90,6 @@ else
 
 	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




More information about the lldb-commits mailing list