xtc/tools/stress.py

33 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Run existing publication/GUI tests while two ordinary CPU workers contend."""
import argparse
from pathlib import Path
import subprocess
import sys
def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument('--build-dir', type=Path, required=True)
p.add_argument('--gui', action='store_true')
a = p.parse_args()
workers = []
try:
for _ in range(2):
workers.append(subprocess.Popen([sys.executable, '-c', 'x=1\nwhile True: x=(x*1664525+1013904223)&0xffffffff']))
for name in ('test_realtime', 'test_reliability', 'test_scale'):
subprocess.run([str((a.build_dir / name).resolve())], check=True, timeout=120)
if a.gui:
# The GUI suite pumps timers and forces redraw during engine/edit tests.
subprocess.run(['xvfb-run', '-a', '-s', '-screen 0 1280x800x24',
str((a.build_dir / 'test_gui').resolve())], check=True, timeout=120)
finally:
for w in workers:
w.terminate()
for w in workers:
w.wait(timeout=10)
print('Publication, capacity and optional GUI/timer tests passed under two CPU workers.')
if __name__ == '__main__':
main()