Repository navigation
Expand file tree
/
Copy pathlarge_frames.py
More file actions
35 lines (30 loc) · 1.6 KB
/
Copy pathlarge_frames.py
File metadata and controls
35 lines (30 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Large-frame and alternate-arrival integration through the runner (correctness, not performance)."""
import argparse
import json
import subprocess
import sys
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--fast", action="store_true", help="both servers use their fast parser")
args = parser.parse_args()
folder = ROOT / "results" / f"large-frames-{'fast' if args.fast else 'library'}-{time.strftime('%Y%m%d-%H%M%S')}"
matrix = json.loads((ROOT / "bench/matrices/large-frames.json").read_text(encoding="utf-8"))
if args.fast:
matrix.setdefault("defaults", {}).update({"csharp_parser": "fast", "cpp_parser": "fast"})
folder.parent.mkdir(exist_ok=True)
matrix_path = folder.parent / f"{folder.name}-matrix.json"
matrix_path.write_text(json.dumps(matrix, indent=2), encoding="utf-8")
subprocess.run([sys.executable, str(ROOT / "bench/run.py"), "--matrix", str(matrix_path),
"--output", str(folder), "--cooldown", "0.2"], check=True)
results = json.loads((folder / "results.json").read_text(encoding="utf-8"))
failures = [(r["cell"]["name"], r["server"], r["runner_error"]) for r in results if r["runner_error"]]
assert not failures, failures
for r in results:
counts = r["result"]["counts"]
assert r["result"]["valid"] and counts["acknowledged"] == r["server_result"]["measured"]["frames"], r["path"]
print(json.dumps({"passed_trials": len(results), "results": str(folder)}))
if __name__ == "__main__":
main()