MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / validate_events

Function validate_events

tests/test_coverage_children.py:222–253  ·  view source on GitHub ↗
(case_name, events)

Source from the content-addressed store, hash-verified

220
221
222def validate_events(case_name, events):
223 pids, final = set(), {}
224 for name, rows in events.items():
225 obstacle = case_name == "explicit_write_failure" or name == "normal_bad"
226 stages = ["ready"]
227 if obstacle:
228 stages += ["obstacle_held", "obstacle_reaped", "obstacle_removed"]
229 if name in ("execve", "execv", "execvp", "execl"):
230 stages += ["exec_held"]
231 if name == "failed_exec":
232 stages += ["execve_failed", "execv_failed", "execvp_failed", "execl_failed"]
233 stages += ["reaped"]
234 if [row["stage"] for row in rows] != stages:
235 raise Infrastructure("missing, duplicate, or unordered child events: " + name)
236 pid = rows[0]["pid"]
237 if pid in pids or any(row["pid"] != pid for row in rows):
238 raise Infrastructure("child PID evidence inconsistent")
239 pids.add(pid)
240 if rows[0]["marker"] != 1 or rows[0]["code"] != 0:
241 raise Infrastructure("post-atfork initial marker was not observed")
242 expected_status = 128 + signal.SIGKILL if name == "setup_killed" else 0
243 if rows[-1]["code"] != expected_status or rows[-1]["marker"] < 0:
244 raise Infrastructure("child was not reaped with its expected status")
245 for row in rows[1:-1]:
246 if row["stage"].startswith("obstacle_"):
247 good = row["code"] == 1 and row["marker"] == -1
248 else:
249 good = row["marker"] >= 0 and row["code"] == (errno.ENOENT if name == "failed_exec" else 0)
250 if not good:
251 raise Infrastructure("child gate/obstacle control failed")
252 final[name] = rows[-1]
253 return final
254
255
256def validate_native_errors(stderr, expected_paths):

Callers 1

run_caseFunction · 0.85

Calls 2

setFunction · 0.85
InfrastructureClass · 0.70

Tested by

no test coverage detected