Skip to content

Commit fe5b914

Browse files
committed
tests: scale memory_ipc outer timeout with child_timeout_sec
Replace the fixed 300 s pytest.mark.timeout with 3 * child_timeout_sec(). This is the minimum that lets the worst-case test in the suite (currently TestIpcReexport, with three sequential CHILD_TIMEOUT_SEC waits in the failure path) reach its own asserts before the outer guard fires. Resulting budgets: - Without compute-sanitizer: 90 s (down from 300 s). - Under compute-sanitizer: 360 s (up from 300 s -- the previous value would have killed TestIpcReexport mid-second-join before its "process C did not signal completion within timeout" assertion could produce a clean failure message). The meta-test test_outer_timeout_marker_is_applied now computes the expected timeout from the same formula so the two stay in sync.
1 parent 63e17a9 commit fe5b914

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

cuda_core/tests/memory_ipc/conftest.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,23 @@
1313
import pathlib
1414

1515
import pytest
16+
from helpers.child_processes import child_timeout_sec
1617

1718
_HERE = pathlib.Path(__file__).parent.resolve()
18-
_TIMEOUT_SEC = 300 # 5 minutes per test; generous compared to child_timeout_sec().
19+
20+
21+
def _outer_timeout_sec() -> int:
22+
# The worst-case IPC test has three sequential CHILD_TIMEOUT_SEC waits in
23+
# the failure path (e.g. TestIpcReexport: event_c.wait, proc_b.join,
24+
# proc_c.join). Scaling by 3 lets such a test reach its own asserts before
25+
# the outer guard fires, while still cutting the budget by half on
26+
# non-sanitizer runs (90 s vs the previous 300 s) and scaling up under
27+
# compute-sanitizer (360 s).
28+
return 3 * child_timeout_sec()
1929

2030

2131
def pytest_collection_modifyitems(config, items):
22-
marker = pytest.mark.timeout(_TIMEOUT_SEC)
32+
marker = pytest.mark.timeout(_outer_timeout_sec())
2333
for item in items:
2434
try:
2535
item_path = pathlib.Path(str(item.fspath)).resolve()

cuda_core/tests/memory_ipc/test_errors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ def test_outer_timeout_marker_is_applied(request):
2525
the in-test cleanup -- which we want to keep as defense in depth, not as
2626
the sole guard.
2727
"""
28+
expected = 3 * child_timeout_sec()
2829
marker = request.node.get_closest_marker("timeout")
2930
assert marker is not None, "memory_ipc/conftest.py did not apply a timeout marker"
30-
assert marker.args == (300,), f"unexpected timeout value: {marker.args!r}"
31+
assert marker.args == (expected,), f"unexpected timeout value: {marker.args!r}"
3132

3233

3334
class ChildErrorHarness:

0 commit comments

Comments
 (0)