[CI] [NPU] precise-test: collect multimodal_gen coverage per test case (#45553)

This commit is contained in:
shun8686
2026-10-22 15:11:47 +08:00
committed by GitHub
parent 569dda1e61
commit 33a0734ca1
5 changed files with 266 additions and 14 deletions
@@ -30,7 +30,17 @@ _PERFORMANCE_TOLERANCE = 0.25
def _kill_process_tree(proc: subprocess.Popen) -> None:
try:
os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
pgid = os.getpgid(proc.pid)
# Coverage collection can only flush a traced subprocess on a graceful
# stop (SIGKILL skips atexit). Give the cluster a SIGTERM head start
# when coverage is active, then always escalate to SIGKILL.
if os.environ.get("COVERAGE_PROCESS_START"):
os.killpg(pgid, signal.SIGTERM)
try:
proc.wait(timeout=30)
except subprocess.TimeoutExpired:
pass
os.killpg(pgid, signal.SIGKILL)
except (ProcessLookupError, PermissionError):
pass