[Lldb-commits] [PATCH] D85537: [lldb] Store the Apple SDK in the configuration and use it to determine the platform.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 7 10:02:17 PDT 2020


JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
JDevlieghere requested review of this revision.

What the title says. This is part of upstreaming the last missing pieces to run the on-device test suite with the upstream repository.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D85537

Files:
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/lldbplatformutil.py


Index: lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -129,17 +129,28 @@
 
 def getPlatform():
     """Returns the target platform which the tests are running on."""
+    # Use the Apple SDK to determine the platform if set.
+    if configuration.apple_sdk:
+        platform = configuration.apple_sdk
+        dot = sdk.find('.')
+        if dot != -1:
+            platform = sdk[:dot]
+        if platform == 'iphoneos':
+            platform = 'ios'
+        return platform
+
+    # Use the triple to determine the platform if set.
     triple = lldb.selected_platform.GetTriple()
-    if triple is None:
-      # It might be an unconnected remote platform.
-      return ''
-
-    platform = triple.split('-')[2]
-    if platform.startswith('freebsd'):
-        platform = 'freebsd'
-    elif platform.startswith('netbsd'):
-        platform = 'netbsd'
-    return platform
+    if triple:
+        platform = triple.split('-')[2]
+        if platform.startswith('freebsd'):
+            platform = 'freebsd'
+        elif platform.startswith('netbsd'):
+            platform = 'netbsd'
+        return platform
+
+    # It still might be an unconnected remote platform.
+    return ''
 
 
 def platformIsDarwin():
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -426,6 +426,8 @@
         configuration.lldb_platform_url = args.lldb_platform_url
     if args.lldb_platform_working_dir:
         configuration.lldb_platform_working_dir = args.lldb_platform_working_dir
+    if args.apple_sdk:
+        configuration.apple_sdk = args.apple_sdk
     if args.test_build_dir:
         configuration.test_build_dir = args.test_build_dir
     if args.lldb_module_cache_dir:
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -117,6 +117,9 @@
 lldb_platform_url = None
 lldb_platform_working_dir = None
 
+# Apple SDK
+apple_sdk = None
+
 # The base directory in which the tests are being built.
 test_build_dir = None
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85537.283937.patch
Type: text/x-patch
Size: 2489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200807/b13c9501/attachment.bin>


More information about the lldb-commits mailing list