Skip to content

Commit fbd5507

Browse files
committed
[lldb] Use the host architecture in TestAppleSimulatorOSType.py
1 parent f1ff6d2 commit fbd5507

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
2-
31
import gdbremote_testcase
42
import lldbgdbserverutils
53
from lldbsuite.test.decorators import *
64
from lldbsuite.test.lldbtest import *
75
from lldbsuite.test import lldbutil
86

97
import json
8+
import platform
109

1110
@skipIfReproducer
1211
class TestAppleSimulatorOSType(gdbremote_testcase.GdbRemoteTestCaseBase):
@@ -16,7 +15,7 @@ class TestAppleSimulatorOSType(gdbremote_testcase.GdbRemoteTestCaseBase):
1615
# Number of stderr lines to read from the simctl output.
1716
READ_LINES = 10
1817

19-
def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
18+
def check_simulator_ostype(self, sdk, platform_name):
2019
cmd = ['xcrun', 'simctl', 'list', '-j', 'devices']
2120
self.trace(' '.join(cmd))
2221
sim_devices_str = subprocess.check_output(cmd).decode("utf-8")
@@ -31,7 +30,7 @@ def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
3130
else:
3231
runtime = simulator
3332
devices = sim_devices[simulator]
34-
if not platform in runtime.lower():
33+
if not platform_name in runtime.lower():
3534
continue
3635
for device in devices:
3736
if 'availability' in device and device['availability'] != '(available)':
@@ -47,10 +46,10 @@ def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
4746

4847
# Launch the process using simctl
4948
self.assertIsNotNone(deviceUDID)
50-
exe_name = 'test_simulator_platform_{}'.format(platform)
49+
exe_name = 'test_simulator_platform_{}'.format(platform_name)
5150
sdkroot = lldbutil.get_xcode_sdk_root(sdk)
5251
self.build(dictionary={ 'EXE': exe_name, 'SDKROOT': sdkroot.strip(),
53-
'ARCH': arch })
52+
'ARCH': platform.machine() })
5453
exe_path = self.getBuildArtifact(exe_name)
5554
cmd = [
5655
'xcrun', 'simctl', 'spawn', '-s', deviceUDID, exe_path,
@@ -96,7 +95,7 @@ def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
9695
self.assertIsNotNone(process_info)
9796

9897
# Check that ostype is correct
99-
self.assertEquals(process_info['ostype'], platform + 'simulator')
98+
self.assertEquals(process_info['ostype'], platform_name + 'simulator')
10099

101100
# Now for dylibs
102101
dylib_info_raw = context.get("dylib_info_raw")
@@ -111,26 +110,26 @@ def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
111110
break
112111

113112
self.assertIsNotNone(image_info)
114-
self.assertEquals(image['min_version_os_name'], platform + 'simulator')
113+
self.assertEquals(image['min_version_os_name'], platform_name + 'simulator')
115114

116115

117116
@apple_simulator_test('iphone')
118117
@debugserver_test
119118
@skipIfRemote
120119
def test_simulator_ostype_ios(self):
121120
self.check_simulator_ostype(sdk='iphonesimulator',
122-
platform='ios')
121+
platform_name='ios')
123122

124123
@apple_simulator_test('appletv')
125124
@debugserver_test
126125
@skipIfRemote
127126
def test_simulator_ostype_tvos(self):
128127
self.check_simulator_ostype(sdk='appletvsimulator',
129-
platform='tvos')
128+
platform_name='tvos')
130129

131130
@apple_simulator_test('watch')
132131
@debugserver_test
133132
@skipIfRemote
134133
def test_simulator_ostype_watchos(self):
135134
self.check_simulator_ostype(sdk='watchsimulator',
136-
platform='watchos', arch='i386')
135+
platform_name='watchos')

0 commit comments

Comments
 (0)