| 560 | |
| 561 | |
| 562 | def test( project, package, valgrind): |
| 563 | |
| 564 | run(f'pip install {test_packages}') |
| 565 | if valgrind: |
| 566 | log('Installing valgrind.') |
| 567 | run(f'sudo apt update') |
| 568 | run(f'sudo apt install valgrind') |
| 569 | run(f'valgrind --version') |
| 570 | |
| 571 | log('Running PyMuPDF tests under valgrind.') |
| 572 | # We ignore memory leaks. |
| 573 | run( |
| 574 | f'{sys.executable} {project}/tests/run_compound.py' |
| 575 | f' valgrind --suppressions={project}/valgrind.supp --error-exitcode=100 --errors-for-leak-kinds=none --fullpath-after=' |
| 576 | f' pytest {project}/tests' |
| 577 | , |
| 578 | env_extra=dict( |
| 579 | PYTHONMALLOC='malloc', |
| 580 | PYMUPDF_RUNNING_ON_VALGRIND='1', |
| 581 | ), |
| 582 | ) |
| 583 | else: |
| 584 | run(f'{sys.executable} {project}/tests/run_compound.py pytest {project}/tests') |
| 585 | |
| 586 | |
| 587 | if platform.system() == 'Windows': |