chia-blockchain/tests/check_pytest_monitor_output.py
Arvid Norberg 4745c60c11
add stress tests with malicious generators (#8570)
* add tests with malicious generators

* raise limit for stress tests
2021-09-29 11:41:49 -07:00

33 lines
888 B
Python
Executable File

#!/usr/bin/env python3
import sys
ret = 0
# example input line
# test_non_tx_aggregate_limits 0.997759588095738 1.45325589179993 554.45703125
for ln in sys.stdin:
line = ln.strip().split()
print(f"{float(line[1]) * 100.0: 8.1f}% CPU {float(line[2]):7.1f}s {float(line[3]): 8.2f} MB RAM {line[0]}")
limit = 800
# until this can be optimized, use higher limits
if "test_duplicate_coin_announces" in line[0]:
limit = 2200
elif (
"test_duplicate_large_integer_substr" in line[0]
or "test_duplicate_reserve_fee" in line[0]
or "test_duplicate_large_integer_negative" in line[0]
or "test_duplicate_large_integer" in line[0]
):
limit = 1100
if float(line[3]) > limit:
print(" ERROR: ^^ exceeded RAM limit ^^ \n")
ret += 1
if ret > 0:
print("some tests used too much RAM")
sys.exit(ret)