Skip to content

Commit 306fde5

Browse files
committed
[lldb] Revive TestSimulatorPlatform.py
This test was incorrectly disabled. Reviving it and removing the checks for LC_VERSION_MIN_FOO as more recent Xcode's don't have the necessary simulator runtimes.
1 parent c5f3018 commit 306fde5

File tree

1 file changed

+14
-153
lines changed

1 file changed

+14
-153
lines changed

lldb/test/API/macosx/simulator/TestSimulatorPlatform.py

Lines changed: 14 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@
88
class TestSimulatorPlatformLaunching(TestBase):
99
NO_DEBUG_INFO_TESTCASE = True
1010

11-
def check_load_commands(self, expected_load_command):
12-
"""sanity check the built binary for the expected number of load commands"""
13-
load_cmds = subprocess.check_output(
14-
["otool", "-l", self.getBuildArtifact()]
15-
).decode("utf-8")
16-
found = 0
17-
for line in load_cmds.split("\n"):
18-
if expected_load_command in line:
19-
found += 1
20-
self.assertEqual(
21-
found,
22-
1,
23-
"wrong number of load commands for {}".format(expected_load_command),
24-
)
25-
2611
def check_debugserver(self, log, expected_platform, expected_version):
2712
"""scan the debugserver packet log"""
2813
process_info = lldbutil.packetlog_get_process_info(log)
@@ -39,8 +24,7 @@ def check_debugserver(self, log, expected_platform, expected_version):
3924
if expected_version:
4025
self.assertEqual(aout_info["min_version_os_sdk"], expected_version)
4126

42-
@skipIf(bugnumber="rdar://76995109")
43-
def run_with(self, arch, os, vers, env, expected_load_command):
27+
def run_with(self, arch, os, vers, env):
4428
env_list = [env] if env else []
4529
triple = "-".join([arch, "apple", os + vers] + env_list)
4630
sdk = lldbutil.get_xcode_sdk(os, env)
@@ -61,11 +45,11 @@ def run_with(self, arch, os, vers, env, expected_load_command):
6145
"ARCH": arch,
6246
"ARCH_CFLAGS": "-target {} {}".format(triple, version_min),
6347
"SDKROOT": sdk_root,
48+
"USE_SYSTEM_STDLIB": 1,
6449
},
6550
compiler=clang,
6651
)
6752

68-
self.check_load_commands(expected_load_command)
6953
log = self.getBuildArtifact("packets.log")
7054
self.expect("log enable gdb-remote packets -f " + log)
7155
lldbutil.run_to_source_breakpoint(
@@ -86,183 +70,60 @@ def test_ios(self):
8670
os="ios",
8771
vers="",
8872
env="simulator",
89-
expected_load_command="LC_BUILD_VERSION",
9073
)
9174

9275
@skipIfAsan
9376
@skipUnlessDarwin
9477
@skipIfDarwinEmbedded
9578
@apple_simulator_test("appletv")
9679
def test_tvos(self):
97-
"""Test running an tvOS simulator binary"""
80+
"""Test running a tvOS simulator binary"""
9881
self.run_with(
9982
arch=self.getArchitecture(),
10083
os="tvos",
10184
vers="",
10285
env="simulator",
103-
expected_load_command="LC_BUILD_VERSION",
10486
)
10587

10688
@skipIfAsan
10789
@skipUnlessDarwin
10890
@skipIfDarwinEmbedded
109-
@apple_simulator_test("watch")
110-
@skipIfDarwin # rdar://problem/64552748
111-
@skipIf(archs=["arm64", "arm64e"])
112-
def test_watchos_i386(self):
113-
"""Test running a 32-bit watchOS simulator binary"""
91+
@apple_simulator_test("appletv")
92+
def test_watchos(self):
93+
"""Test running a watchOS simulator binary"""
11494
self.run_with(
115-
arch="i386",
95+
arch=self.getArchitecture(),
11696
os="watchos",
11797
vers="",
11898
env="simulator",
119-
expected_load_command="LC_BUILD_VERSION",
12099
)
121100

122101
@skipIfAsan
123102
@skipUnlessDarwin
124103
@skipIfDarwinEmbedded
125104
@apple_simulator_test("watch")
126105
@skipIfDarwin # rdar://problem/64552748
127-
@skipIf(archs=["i386", "x86_64"])
128-
def test_watchos_armv7k(self):
129-
"""Test running a 32-bit watchOS simulator binary"""
130-
self.run_with(
131-
arch="armv7k",
132-
os="watchos",
133-
vers="",
134-
env="simulator",
135-
expected_load_command="LC_BUILD_VERSION",
136-
)
137-
138-
#
139-
# Back-deployment tests.
140-
#
141-
# Older Mach-O versions used less expressive load commands, such
142-
# as LC_VERSION_MIN_IPHONEOS that wouldn't distinguish between ios
143-
# and ios-simulator. When targeting a simulator on Apple Silicon
144-
# macOS, however, these legacy load commands are never generated.
145-
#
146-
147-
@skipUnlessDarwin
148-
@skipIfDarwinEmbedded
149-
def test_lc_version_min_macosx(self):
150-
"""Test running a back-deploying non-simulator MacOS X binary"""
151-
self.run_with(
152-
arch=self.getArchitecture(),
153-
os="macosx",
154-
vers="10.9",
155-
env="",
156-
expected_load_command="LC_VERSION_MIN_MACOSX",
157-
)
158-
159-
@skipIfAsan
160-
@skipUnlessDarwin
161-
@skipIfDarwinEmbedded
162-
@apple_simulator_test("iphone")
163-
@skipIf(archs=["arm64", "arm64e"])
164-
def test_lc_version_min_iphoneos(self):
165-
"""Test running a back-deploying iOS simulator binary
166-
with a legacy iOS load command"""
167-
self.run_with(
168-
arch=self.getArchitecture(),
169-
os="ios",
170-
vers="11.0",
171-
env="simulator",
172-
expected_load_command="LC_VERSION_MIN_IPHONEOS",
173-
)
174-
175-
@skipIfAsan
176-
@skipUnlessDarwin
177-
@skipIfDarwinEmbedded
178-
@apple_simulator_test("iphone")
179106
@skipIf(archs=["arm64", "arm64e"])
180-
def test_ios_backdeploy_x86(self):
181-
"""Test running a back-deploying iOS simulator binary
182-
with a legacy iOS load command"""
183-
self.run_with(
184-
arch=self.getArchitecture(),
185-
os="ios",
186-
vers="13.0",
187-
env="simulator",
188-
expected_load_command="LC_BUILD_VERSION",
189-
)
190-
191-
@skipIfAsan
192-
@skipUnlessDarwin
193-
@skipIfDarwinEmbedded
194-
@apple_simulator_test("iphone")
195-
@skipIf(archs=["i386", "x86_64"])
196-
def test_ios_backdeploy_apple_silicon(self):
197-
"""Test running a back-deploying iOS simulator binary"""
198-
self.run_with(
199-
arch=self.getArchitecture(),
200-
os="ios",
201-
vers="11.0",
202-
env="simulator",
203-
expected_load_command="LC_BUILD_VERSION",
204-
)
205-
206-
@skipIfAsan
207-
@skipUnlessDarwin
208-
@skipIfDarwinEmbedded
209-
@apple_simulator_test("appletv")
210-
@skipIf(archs=["arm64", "arm64e"])
211-
def test_lc_version_min_tvos(self):
212-
"""Test running a back-deploying tvOS simulator binary
213-
with a legacy tvOS load command"""
214-
self.run_with(
215-
arch=self.getArchitecture(),
216-
os="tvos",
217-
vers="11.0",
218-
env="simulator",
219-
expected_load_command="LC_VERSION_MIN_TVOS",
220-
)
221-
222-
@skipIfAsan
223-
@skipUnlessDarwin
224-
@skipIfDarwinEmbedded
225-
@apple_simulator_test("appletv")
226-
@skipIf(archs=["i386", "x86_64"])
227-
def test_tvos_backdeploy_apple_silicon(self):
228-
"""Test running a back-deploying tvOS simulator binary"""
229-
self.run_with(
230-
arch=self.getArchitecture(),
231-
os="tvos",
232-
vers="11.0",
233-
env="simulator",
234-
expected_load_command="LC_BUILD_VERSION",
235-
)
236-
237-
@skipIfAsan
238-
@skipUnlessDarwin
239-
@skipIfDarwinEmbedded
240-
@apple_simulator_test("watch")
241-
@skipIf(archs=["arm64", "arm64e"])
242-
@skipIfDarwin # rdar://problem/64552748
243-
def test_lc_version_min_watchos(self):
244-
"""Test running a back-deploying watchOS simulator binary
245-
with a legacy watchOS load command"""
107+
def test_watchos_i386(self):
108+
"""Test running a 32-bit watchOS simulator binary"""
246109
self.run_with(
247110
arch="i386",
248111
os="watchos",
249-
vers="4.0",
112+
vers="",
250113
env="simulator",
251-
expected_load_command="LC_VERSION_MIN_WATCHOS",
252114
)
253115

254116
@skipIfAsan
255117
@skipUnlessDarwin
256118
@skipIfDarwinEmbedded
257119
@apple_simulator_test("watch")
258-
@skipIf(archs=["arm64", "arm64e"])
259120
@skipIfDarwin # rdar://problem/64552748
260-
def test_watchos_backdeploy_apple_silicon(self):
261-
"""Test running a back-deploying watchOS simulator binary"""
121+
@skipIf(archs=["i386", "x86_64"])
122+
def test_watchos_armv7k(self):
123+
"""Test running a 32-bit watchOS simulator binary"""
262124
self.run_with(
263125
arch="armv7k",
264126
os="watchos",
265-
vers="4.0",
127+
vers="",
266128
env="simulator",
267-
expected_load_command="LC_BUILD_VERSION",
268129
)

0 commit comments

Comments
 (0)