Changeset View
Changeset View
Standalone View
Standalone View
test/fuzz/test_runner.py
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | for t in test_list: | ||||
os.makedirs(corpus_path, exist_ok=True) | os.makedirs(corpus_path, exist_ok=True) | ||||
args = [ | args = [ | ||||
os.path.join(test_dir, t), | os.path.join(test_dir, t), | ||||
'-runs=1', | '-runs=1', | ||||
'-detect_leaks=0', | '-detect_leaks=0', | ||||
corpus_path, | corpus_path, | ||||
] | ] | ||||
logging.debug('Run {} with args {}'.format(t, args)) | logging.debug('Run {} with args {}'.format(t, args)) | ||||
output = subprocess.run( | result = subprocess.run( | ||||
args, check=True, stderr=subprocess.PIPE, universal_newlines=True).stderr | args, | ||||
stderr=subprocess.PIPE, | |||||
universal_newlines=True) | |||||
output = result.stderr | |||||
logging.debug('Output: {}'.format(output)) | logging.debug('Output: {}'.format(output)) | ||||
result.check_returncode() | |||||
if not export_coverage: | if not export_coverage: | ||||
continue | continue | ||||
for line in output.splitlines(): | for line in output.splitlines(): | ||||
if 'INITED' in line: | if 'INITED' in line: | ||||
with open(os.path.join(corpus, t + '_coverage'), 'w', encoding='utf-8') as cov_file: | with open(os.path.join(corpus, t + '_coverage'), 'w', encoding='utf-8') as cov_file: | ||||
cov_file.write(line) | cov_file.write(line) | ||||
break | break | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
main() | main() |