diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py --- 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 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/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: diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/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 = 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():