Files
go-omni/scripts/verifyPerformance.py

39 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Run GoOmni's repeatable stability checks and transport performance baseline."""
import argparse
import os
from pathlib import Path
import subprocess
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--go", default="go")
parser.add_argument("--count", type=int, default=3)
args = parser.parse_args()
root = Path(__file__).resolve().parent.parent
env = dict(os.environ, GOWORK="off")
checks = [
([args.go, "test", "-race", "./..."], "race tests"),
([args.go, "vet", "./..."], "vet"),
([args.go, "build", "./..."], "build"),
(
[args.go, "test", "-run", "^$", "-bench", "^BenchmarkTransport",
"-benchmem", "-count", str(args.count), "./transport"],
"transport benchmarks",
),
]
for command, name in checks:
print(f"Running {name}", flush=True)
result = subprocess.run(command, cwd=root, env=env, text=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(result.stdout, end="")
if result.returncode != 0:
raise SystemExit(f"{name} failed with exit code {result.returncode}")
print("PASS stability checks and transport performance baseline", flush=True)
if __name__ == "__main__":
main()