cpptrace/ci/speedtest.py
2023-07-20 22:09:59 -04:00

34 lines
821 B
Python

import sys
import re
def main():
output = sys.stdin.read()
print(output)
print("-" * 50)
time = int(re.search(r"\d+ tests? from \d+ test suites? ran. \((\d+) ms total\)", output).group(1))
dwarf4 = any(["DWARF4" in arg for arg in sys.argv[1:]])
dwarf5 = any(["DWARF5" in arg for arg in sys.argv[1:]])
expect_slow = dwarf4
threshold = 100 # ms
if expect_slow:
if time > threshold:
print(f"Success (expecting slow): Test program took {time} ms")
else:
print(f"Error (expecting slow): Test program took {time} ms")
sys.exit(1)
else:
if time > threshold:
print(f"Error: Test program took {time} ms")
sys.exit(1)
else:
print(f"Success: Test program took {time} ms")
main()