[Lldb-commits] [lldb] f1d5257 - [lldb] Store the Apple SDK in dotest's configuration.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 7 11:13:44 PDT 2020
Author: Jonas Devlieghere
Date: 2020-08-07T11:13:18-07:00
New Revision: f1d525734f86ac4b1a7bf80f3a82291864026de0
URL: https://github.com/llvm/llvm-project/commit/f1d525734f86ac4b1a7bf80f3a82291864026de0
DIFF: https://github.com/llvm/llvm-project/commit/f1d525734f86ac4b1a7bf80f3a82291864026de0.diff
LOG: [lldb] Store the Apple SDK in dotest's configuration.
This patch stores the --apple-sdk argument in the dotest configuration.
When it's set, use it instead of the triple to determine the current
platform.
Differential revision: https://reviews.llvm.org/D85537
Added:
Modified:
lldb/packages/Python/lldbsuite/test/configuration.py
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index 251787b940e3..6f4b89cb1793 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/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
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index f84bda68d951..10faa67b6508 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -426,6 +426,8 @@ def parseOptionsAndInitTestdirs():
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:
diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 44659cac4c77..cc21865e4751 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -129,17 +129,28 @@ def getDarwinOSTriples():
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 = platform.find('.')
+ if dot != -1:
+ platform = platform[: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():
More information about the lldb-commits
mailing list