tests: Adjust nice and oom_adj values on linux

The testsuite calls resvg, and that sometimes can use up *a lot* of
memory. We adjust the test process tree's nice values and oom_adj values
to make sure the test processes get killed during an OOM condition
before anything else on the system.
merge-requests/4/head
jaseg 2024-07-18 11:33:46 +02:00
rodzic edaf246b9d
commit 885ce36fd3
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -40,6 +40,11 @@ def pytest_sessionstart(session):
def pytest_configure(config):
os.nice(20)
# Resvg can sometimes consume a lot of memory. Make sure we don't kill the user's session.
if (oom_adj := Path('/proc/self/oom_adj')).is_file():
oom_adj.write_text('15\n')
if 'PYTEST_XDIST_WORKER' in os.environ: # only run this on the controller
return