llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Raphael Isemann (Teemperor)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/209180.diff


4 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/lldbutil.py (+9-5) 
- (modified) lldb/test/API/macosx/simulator/TestSimulatorPlatform.py (+1) 
- (modified) lldb/test/API/macosx/simulator/hello.cpp (+3-1) 
- (modified) 
lldb/test/API/tools/lldb-server/apple-simulator/TestAppleSimulatorOSType.py 
(+2-1) 


``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 91f872bce3827..aa8ce2a52e7bb 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -1824,6 +1824,7 @@ def get_latest_apple_simulator(platform_name, log=None):
 
 
 def launch_exe_in_apple_simulator(
+    test,
     device_uuid,
     exe_path,
     exe_args=[],
@@ -1831,17 +1832,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,
         )

``````````

</details>


https://github.com/llvm/llvm-project/pull/209180
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to