https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/142244
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. >From 306fde550dbe211e9feff084c7fabd4af99627ed Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere <jo...@devlieghere.com> Date: Fri, 30 May 2025 17:15:56 -0700 Subject: [PATCH] [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. --- .../macosx/simulator/TestSimulatorPlatform.py | 167 ++---------------- 1 file changed, 14 insertions(+), 153 deletions(-) diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py index faf2256b03a0d..af12bd16a22a4 100644 --- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py +++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -8,21 +8,6 @@ class TestSimulatorPlatformLaunching(TestBase): NO_DEBUG_INFO_TESTCASE = True - def check_load_commands(self, expected_load_command): - """sanity check the built binary for the expected number of load commands""" - load_cmds = subprocess.check_output( - ["otool", "-l", self.getBuildArtifact()] - ).decode("utf-8") - found = 0 - for line in load_cmds.split("\n"): - if expected_load_command in line: - found += 1 - self.assertEqual( - found, - 1, - "wrong number of load commands for {}".format(expected_load_command), - ) - def check_debugserver(self, log, expected_platform, expected_version): """scan the debugserver packet log""" process_info = lldbutil.packetlog_get_process_info(log) @@ -39,8 +24,7 @@ def check_debugserver(self, log, expected_platform, expected_version): if expected_version: self.assertEqual(aout_info["min_version_os_sdk"], expected_version) - @skipIf(bugnumber="rdar://76995109") - def run_with(self, arch, os, vers, env, expected_load_command): + def run_with(self, arch, os, vers, env): env_list = [env] if env else [] triple = "-".join([arch, "apple", os + vers] + env_list) sdk = lldbutil.get_xcode_sdk(os, env) @@ -61,11 +45,11 @@ def run_with(self, arch, os, vers, env, expected_load_command): "ARCH": arch, "ARCH_CFLAGS": "-target {} {}".format(triple, version_min), "SDKROOT": sdk_root, + "USE_SYSTEM_STDLIB": 1, }, compiler=clang, ) - self.check_load_commands(expected_load_command) log = self.getBuildArtifact("packets.log") self.expect("log enable gdb-remote packets -f " + log) lldbutil.run_to_source_breakpoint( @@ -86,7 +70,6 @@ def test_ios(self): os="ios", vers="", env="simulator", - expected_load_command="LC_BUILD_VERSION", ) @skipIfAsan @@ -94,29 +77,25 @@ def test_ios(self): @skipIfDarwinEmbedded @apple_simulator_test("appletv") def test_tvos(self): - """Test running an tvOS simulator binary""" + """Test running a tvOS simulator binary""" self.run_with( arch=self.getArchitecture(), os="tvos", vers="", env="simulator", - expected_load_command="LC_BUILD_VERSION", ) @skipIfAsan @skipUnlessDarwin @skipIfDarwinEmbedded - @apple_simulator_test("watch") - @skipIfDarwin # rdar://problem/64552748 - @skipIf(archs=["arm64", "arm64e"]) - def test_watchos_i386(self): - """Test running a 32-bit watchOS simulator binary""" + @apple_simulator_test("appletv") + def test_watchos(self): + """Test running a watchOS simulator binary""" self.run_with( - arch="i386", + arch=self.getArchitecture(), os="watchos", vers="", env="simulator", - expected_load_command="LC_BUILD_VERSION", ) @skipIfAsan @@ -124,145 +103,27 @@ def test_watchos_i386(self): @skipIfDarwinEmbedded @apple_simulator_test("watch") @skipIfDarwin # rdar://problem/64552748 - @skipIf(archs=["i386", "x86_64"]) - def test_watchos_armv7k(self): - """Test running a 32-bit watchOS simulator binary""" - self.run_with( - arch="armv7k", - os="watchos", - vers="", - env="simulator", - expected_load_command="LC_BUILD_VERSION", - ) - - # - # Back-deployment tests. - # - # Older Mach-O versions used less expressive load commands, such - # as LC_VERSION_MIN_IPHONEOS that wouldn't distinguish between ios - # and ios-simulator. When targeting a simulator on Apple Silicon - # macOS, however, these legacy load commands are never generated. - # - - @skipUnlessDarwin - @skipIfDarwinEmbedded - def test_lc_version_min_macosx(self): - """Test running a back-deploying non-simulator MacOS X binary""" - self.run_with( - arch=self.getArchitecture(), - os="macosx", - vers="10.9", - env="", - expected_load_command="LC_VERSION_MIN_MACOSX", - ) - - @skipIfAsan - @skipUnlessDarwin - @skipIfDarwinEmbedded - @apple_simulator_test("iphone") - @skipIf(archs=["arm64", "arm64e"]) - def test_lc_version_min_iphoneos(self): - """Test running a back-deploying iOS simulator binary - with a legacy iOS load command""" - self.run_with( - arch=self.getArchitecture(), - os="ios", - vers="11.0", - env="simulator", - expected_load_command="LC_VERSION_MIN_IPHONEOS", - ) - - @skipIfAsan - @skipUnlessDarwin - @skipIfDarwinEmbedded - @apple_simulator_test("iphone") @skipIf(archs=["arm64", "arm64e"]) - def test_ios_backdeploy_x86(self): - """Test running a back-deploying iOS simulator binary - with a legacy iOS load command""" - self.run_with( - arch=self.getArchitecture(), - os="ios", - vers="13.0", - env="simulator", - expected_load_command="LC_BUILD_VERSION", - ) - - @skipIfAsan - @skipUnlessDarwin - @skipIfDarwinEmbedded - @apple_simulator_test("iphone") - @skipIf(archs=["i386", "x86_64"]) - def test_ios_backdeploy_apple_silicon(self): - """Test running a back-deploying iOS simulator binary""" - self.run_with( - arch=self.getArchitecture(), - os="ios", - vers="11.0", - env="simulator", - expected_load_command="LC_BUILD_VERSION", - ) - - @skipIfAsan - @skipUnlessDarwin - @skipIfDarwinEmbedded - @apple_simulator_test("appletv") - @skipIf(archs=["arm64", "arm64e"]) - def test_lc_version_min_tvos(self): - """Test running a back-deploying tvOS simulator binary - with a legacy tvOS load command""" - self.run_with( - arch=self.getArchitecture(), - os="tvos", - vers="11.0", - env="simulator", - expected_load_command="LC_VERSION_MIN_TVOS", - ) - - @skipIfAsan - @skipUnlessDarwin - @skipIfDarwinEmbedded - @apple_simulator_test("appletv") - @skipIf(archs=["i386", "x86_64"]) - def test_tvos_backdeploy_apple_silicon(self): - """Test running a back-deploying tvOS simulator binary""" - self.run_with( - arch=self.getArchitecture(), - os="tvos", - vers="11.0", - env="simulator", - expected_load_command="LC_BUILD_VERSION", - ) - - @skipIfAsan - @skipUnlessDarwin - @skipIfDarwinEmbedded - @apple_simulator_test("watch") - @skipIf(archs=["arm64", "arm64e"]) - @skipIfDarwin # rdar://problem/64552748 - def test_lc_version_min_watchos(self): - """Test running a back-deploying watchOS simulator binary - with a legacy watchOS load command""" + def test_watchos_i386(self): + """Test running a 32-bit watchOS simulator binary""" self.run_with( arch="i386", os="watchos", - vers="4.0", + vers="", env="simulator", - expected_load_command="LC_VERSION_MIN_WATCHOS", ) @skipIfAsan @skipUnlessDarwin @skipIfDarwinEmbedded @apple_simulator_test("watch") - @skipIf(archs=["arm64", "arm64e"]) @skipIfDarwin # rdar://problem/64552748 - def test_watchos_backdeploy_apple_silicon(self): - """Test running a back-deploying watchOS simulator binary""" + @skipIf(archs=["i386", "x86_64"]) + def test_watchos_armv7k(self): + """Test running a 32-bit watchOS simulator binary""" self.run_with( arch="armv7k", os="watchos", - vers="4.0", + vers="", env="simulator", - expected_load_command="LC_BUILD_VERSION", ) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits