Files
orch/tests/flake.py
T

19 lines
632 B
Python

#!/usr/bin/env python3
"""Flake hunt: run tests/e2e.py N times, optionally under CPU load. usage: flake.py N [LOADERS]"""
import subprocess, sys
n = int(sys.argv[1])
load = [subprocess.Popen([sys.executable, "-c", "while True: pass"]) for _ in range(int(sys.argv[2]) if len(sys.argv) > 2 else 0)]
bad = 0
try:
for i in range(n):
p = subprocess.run([sys.executable, "tests/e2e.py"], capture_output=True, text=True)
if p.returncode:
bad += 1
print(f"run {i} FAILED\n{p.stderr[-800:]}")
finally:
for l in load:
l.terminate()
print(f"{n - bad}/{n} ok")
sys.exit(1 if bad else 0)