Meta: Make test_pdf.py not count regular "failed to open" as crash

Some files just aren't valid PDF files that e.g. Preview.app can't
open either. Let's not count those (exit code 1) as crashes.
This commit is contained in:
Nico Weber 2023-10-22 23:46:57 -07:00 committed by Tim Flynn
parent 11bee7a075
commit df0dd26ce2
Notes: sideshowbarker 2024-07-17 05:41:34 +09:00

View file

@ -59,12 +59,17 @@ def main():
results = multiprocessing.Pool().map(test_pdf, files)
failed_files = []
num_crashes = 0
stack_to_files = {}
for r in results:
print(r.filename)
print(r.stdout.decode('utf-8'))
if r.returncode != 0:
if r.returncode == 0:
continue
if r.returncode == 1:
failed_files.append(r.filename)
else:
num_crashes += 1
stack_to_files.setdefault(r.stderr, []).append(r.filename)
@ -83,6 +88,12 @@ def main():
print(f'{num_crashes} crashes ({percent:.1f}%)')
print(f'{len(keys)} distinct crash stacks')
percent = 100 * len(failed_files) / len(results)
print()
print(f'{len(failed_files)} failed to open ({percent:.1f}%)')
for f in failed_files:
print(f' {f}')
if __name__ == '__main__':
main()