[Lldb-commits] [lldb] [lldb] Fix test timeouts on sanitized builds (PR #197953)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Fri May 15 08:09:15 PDT 2026
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/197953
Switch to a fixed timeout and a shorter polling interval to reduce wasted time. The total timeout in non-sanitized is 120s (same as the existing implementation) and in sanitized builds, it is 600s matching `lit_config.maxIndividualTestTime`.
Previously, sanitized builds could spend up to 20 seconds idling. While this specific function wouldn't time out itself, it consumed a significant portion of the overall test time budget. This would eventually cause the test to hit the
`lit_config.maxIndividualTestTime` limit (currently 600 seconds).
This delay accumulates quickly in tests with multiple subtests that implicitly rely on `wait_for_file_on_target` (for example, `TestLLDBGdbServer.py`).
If a test has 5 subtests, it could lose 100 seconds (20s * 5) to idle polling, leaving only 500 seconds for the entire test to finish.
>From f88fbcc0fe8cfc99ebb0ef491e3345f99d0b577b Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <e_ezike at apple.com>
Date: Fri, 15 May 2026 15:42:29 +0100
Subject: [PATCH] [lldb] Fix test timeouts on sanitized builds
Switch to a fixed timeout and a shorter polling interval to reduce wasted time.
The total time in non-sanitized builds matches the previous implementation (120s),
and in sanitized builds, it matches `lit_config.maxIndividualTestTime`.
Previously, sanitized builds could spend up to 20 seconds idling.
While this specific function wouldn't time out itself,
it consumed a significant portion of the overall test time budget.
This would eventually cause the test to hit the
`lit_config.maxIndividualTestTime` limit (currently 600 seconds).
This delay accumulates quickly in tests with multiple subtests that
implicitly rely on `wait_for_file_on_target` (for example, `TestLLDBGdbServer.py`).
If a test has 5 subtests, it could lose 100 seconds (20s * 5) to idle polling,
leaving only 500 seconds for the entire test suite to finish.
---
.../Python/lldbsuite/test/lldbutil.py | 23 ++++++++-----------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index ff2c045358b6e..7698c709858e5 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -12,6 +12,7 @@
import re
import sys
import subprocess
+import time
from typing import Dict, Tuple
# LLDB modules
@@ -1690,24 +1691,20 @@ def read_file_from_process_wd(test, name):
return read_file_on_target(test, path)
-def wait_for_file_on_target(testcase, file_path):
- import time
+def wait_for_file_on_target(testcase, file_path: str):
+ timeout_seconds = 600 if "ASAN_OPTIONS" in os.environ else 120
+ sleep_interval_seconds = 0.5
+ deadline_seconds = time.monotonic() + timeout_seconds
- MAX_ATTEMPTS = 60
- timeout_seconds = 20 if "ASAN_OPTIONS" in os.environ else 2
- for i in range(MAX_ATTEMPTS):
+ while time.monotonic() < deadline_seconds:
command = f"ls {file_path}"
- err, retcode, msg = testcase.run_platform_command(command)
+ err, retcode, _ = testcase.run_platform_command(command)
if err.Success() and retcode == 0:
- break
+ return read_file_on_target(testcase, file_path)
- time.sleep(timeout_seconds)
- else:
- testcase.fail(
- "File %s not found even after %d attempts." % (file_path, max_attempts)
- )
+ time.sleep(sleep_interval_seconds)
- return read_file_on_target(testcase, file_path)
+ testcase.fail(f"File {file_path} not found after {timeout_seconds} seconds.")
def packetlog_get_process_info(log):
More information about the lldb-commits
mailing list