mirror of
https://github.com/esphome/esphome.git
synced 2025-08-07 02:47:47 +00:00
preen
This commit is contained in:
parent
49bc767bf4
commit
9188a8e326
@ -33,14 +33,18 @@ async def test_defer_stress(
|
|||||||
test_complete_future: asyncio.Future[None] = loop.create_future()
|
test_complete_future: asyncio.Future[None] = loop.create_future()
|
||||||
|
|
||||||
# Track executed defers and their order
|
# Track executed defers and their order
|
||||||
executed_defers = set()
|
executed_defers: set[int] = set()
|
||||||
thread_executions = {} # thread_id -> list of indices in execution order
|
thread_executions: dict[
|
||||||
fifo_violations = []
|
int, list[int]
|
||||||
|
] = {} # thread_id -> list of indices in execution order
|
||||||
|
fifo_violations: list[str] = []
|
||||||
|
|
||||||
def on_log_line(line: str) -> None:
|
def on_log_line(line: str) -> None:
|
||||||
# Track all executed defers with thread and index info
|
# Track all executed defers with thread and index info
|
||||||
match = re.search(r"Executed defer (\d+) \(thread (\d+), index (\d+)\)", line)
|
match = re.search(r"Executed defer (\d+) \(thread (\d+), index (\d+)\)", line)
|
||||||
if match:
|
if not match:
|
||||||
|
return
|
||||||
|
|
||||||
defer_id = int(match.group(1))
|
defer_id = int(match.group(1))
|
||||||
thread_id = int(match.group(2))
|
thread_id = int(match.group(2))
|
||||||
index = int(match.group(3))
|
index = int(match.group(3))
|
||||||
@ -52,10 +56,7 @@ async def test_defer_stress(
|
|||||||
thread_executions[thread_id] = []
|
thread_executions[thread_id] = []
|
||||||
|
|
||||||
# Check FIFO ordering within thread
|
# Check FIFO ordering within thread
|
||||||
if (
|
if thread_executions[thread_id] and thread_executions[thread_id][-1] >= index:
|
||||||
thread_executions[thread_id]
|
|
||||||
and thread_executions[thread_id][-1] >= index
|
|
||||||
):
|
|
||||||
fifo_violations.append(
|
fifo_violations.append(
|
||||||
f"Thread {thread_id}: index {index} executed after {thread_executions[thread_id][-1]}"
|
f"Thread {thread_id}: index {index} executed after {thread_executions[thread_id][-1]}"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user