Skip to content

Commit f1d5257

Browse files
committed
[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
1 parent c354b2e commit f1d5257

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

lldb/packages/Python/lldbsuite/test/configuration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
lldb_platform_url = None
118118
lldb_platform_working_dir = None
119119

120+
# Apple SDK
121+
apple_sdk = None
122+
120123
# The base directory in which the tests are being built.
121124
test_build_dir = None
122125

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ def parseOptionsAndInitTestdirs():
426426
configuration.lldb_platform_url = args.lldb_platform_url
427427
if args.lldb_platform_working_dir:
428428
configuration.lldb_platform_working_dir = args.lldb_platform_working_dir
429+
if args.apple_sdk:
430+
configuration.apple_sdk = args.apple_sdk
429431
if args.test_build_dir:
430432
configuration.test_build_dir = args.test_build_dir
431433
if args.lldb_module_cache_dir:

lldb/packages/Python/lldbsuite/test/lldbplatformutil.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,28 @@ def getDarwinOSTriples():
129129

130130
def getPlatform():
131131
"""Returns the target platform which the tests are running on."""
132+
# Use the Apple SDK to determine the platform if set.
133+
if configuration.apple_sdk:
134+
platform = configuration.apple_sdk
135+
dot = platform.find('.')
136+
if dot != -1:
137+
platform = platform[:dot]
138+
if platform == 'iphoneos':
139+
platform = 'ios'
140+
return platform
141+
142+
# Use the triple to determine the platform if set.
132143
triple = lldb.selected_platform.GetTriple()
133-
if triple is None:
134-
# It might be an unconnected remote platform.
135-
return ''
136-
137-
platform = triple.split('-')[2]
138-
if platform.startswith('freebsd'):
139-
platform = 'freebsd'
140-
elif platform.startswith('netbsd'):
141-
platform = 'netbsd'
142-
return platform
144+
if triple:
145+
platform = triple.split('-')[2]
146+
if platform.startswith('freebsd'):
147+
platform = 'freebsd'
148+
elif platform.startswith('netbsd'):
149+
platform = 'netbsd'
150+
return platform
151+
152+
# It still might be an unconnected remote platform.
153+
return ''
143154

144155

145156
def platformIsDarwin():

0 commit comments

Comments
 (0)