xtc/tools/stress.py

46 lines
1.9 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')
p.add_argument('--plugin', type=Path, help='optional original test LADSPA fixture')
p.add_argument('--rounds', type=int, default=1)
a = p.parse_args()
if not 1 <= a.rounds <= 1000:
p.error('rounds must be 1..1000')
workers = []
try:
for _ in range(2):
workers.append(subprocess.Popen([sys.executable, '-c', 'x=1\nwhile True: x=(x*1664525+1013904223)&0xffffffff']))
names = ['test_realtime', 'test_reliability', 'test_scale', 'test_portability',
'test_project_diagnostics', 'test_soak']
if (a.build_dir / 'test_backend').exists():
names.append('test_backend')
for iteration in range(a.rounds):
for name in names:
subprocess.run([str((a.build_dir / name).resolve())], check=True, timeout=120)
if a.plugin:
subprocess.run([str((a.build_dir / 'test_plugins').resolve()),
str(a.plugin.resolve()), 'fixture'], check=True, timeout=120)
print(f'Stress round {iteration + 1}/{a.rounds} passed.', flush=True)
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()