Author: Raphael Isemann Date: 2026-07-20T13:48:44+01:00 New Revision: 92873559f90a35f89ebc5ac94a6d7e4c3a419ecb
URL: https://github.com/llvm/llvm-project/commit/92873559f90a35f89ebc5ac94a6d7e4c3a419ecb DIFF: https://github.com/llvm/llvm-project/commit/92873559f90a35f89ebc5ac94a6d7e4c3a419ecb.diff LOG: [lldb][test] Bump safety timeout in simulator tests to fix flakyness (#209180) On really slow machines, the current 10 second timeout can expire and cause the test to randomly fail. Bump the timeout to 10 minutes which 60 times the current value and should be unreachable even on the slowest of machines. To avoid making the tests run for 10 minutes, we now consistently kill the test process on shutdown using the subprocess list in lldbtest which gets killed on tearDown. Added: Modified: lldb/packages/Python/lldbsuite/test/lldbutil.py lldb/test/API/macosx/simulator/TestSimulatorPlatform.py lldb/test/API/macosx/simulator/hello.cpp lldb/test/API/tools/lldb-server/apple-simulator/TestAppleSimulatorOSType.py Removed: ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 0fea68b7c8c52..f2e0b013f8402 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1932,6 +1932,7 @@ def get_latest_apple_simulator(platform_name, log=None): def launch_exe_in_apple_simulator( + test, device_uuid, exe_path, exe_args=[], @@ -1939,17 +1940,20 @@ def launch_exe_in_apple_simulator( log=None, ): exe_path = os.path.realpath(exe_path) - cmd = [ - "xcrun", - "simctl", + # Resolve the path to simctl so we can launch it directly via spawnSubprocess. + simctl_path = ( + subprocess.check_output(["xcrun", "-f", "simctl"]).decode("utf-8").strip() + ) + args = [ "spawn", "-s", device_uuid, exe_path, ] + exe_args if log: - log(" ".join(cmd)) - sim_launcher = subprocess.Popen(cmd, stderr=subprocess.PIPE) + log(simctl_path + " " + " ".join(args)) + # simctl itself gets terminated when the test finishes. + sim_launcher = test.spawnSubprocess(simctl_path, args, stderr=subprocess.PIPE) # Read stderr to try to find matches. # Each pattern will return the value of group[1] of the first match in the stderr. diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py index 7a888cacec44c..7a87db0940e32 100644 --- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py +++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -76,6 +76,7 @@ def run_with(self, arch, os, vers, env, expected_platform=None): expected_platform, self.trace ) _, matched_strings = lldbutil.launch_exe_in_apple_simulator( + self, device_udid, self.getBuildArtifact("a.out"), exe_args=[], diff --git a/lldb/test/API/macosx/simulator/hello.cpp b/lldb/test/API/macosx/simulator/hello.cpp index e202125da0929..e39afa2f1086d 100644 --- a/lldb/test/API/macosx/simulator/hello.cpp +++ b/lldb/test/API/macosx/simulator/hello.cpp @@ -4,7 +4,9 @@ static void print_pid() { fprintf(stderr, "PID: %d\n", getpid()); } -static void sleep() { std::this_thread::sleep_for(std::chrono::seconds(10)); } +// The test kills this process after the `platform process list` check, so this +// sleep should never expire. +static void sleep() { std::this_thread::sleep_for(std::chrono::seconds(600)); } int main(int argc, char **argv) { print_pid(); diff --git a/lldb/test/API/tools/lldb-server/apple-simulator/TestAppleSimulatorOSType.py b/lldb/test/API/tools/lldb-server/apple-simulator/TestAppleSimulatorOSType.py index 9e59ffd5db6e2..814c0c81de369 100644 --- a/lldb/test/API/tools/lldb-server/apple-simulator/TestAppleSimulatorOSType.py +++ b/lldb/test/API/tools/lldb-server/apple-simulator/TestAppleSimulatorOSType.py @@ -53,9 +53,10 @@ def check_simulator_ostype(self, sdk, platform_name, arch=platform.machine()): # Launch the executable in the simulator exe_path, matched_groups = lldbutil.launch_exe_in_apple_simulator( + self, deviceUDID, self.getBuildArtifact(exe_name), - ["print-pid", "sleep:10"], + ["print-pid", "sleep:600"], [r"PID: (.*)"], self.trace, ) _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
