From 885ce36fd3da7f78d046ec7bbcc3d0c59bac650e Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 18 Jul 2024 11:33:46 +0200 Subject: 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. --- gerbonara/tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gerbonara') diff --git a/gerbonara/tests/conftest.py b/gerbonara/tests/conftest.py index 7d4e996..25e8014 100644 --- a/gerbonara/tests/conftest.py +++ b/gerbonara/tests/conftest.py @@ -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 -- cgit