From: Tom Hromatka Date: Wed, 6 Dec 2023 15:37:44 +0000 (+0000) Subject: ftests/systemd: add method to check if systemd support X-Git-Tag: v3.2.0~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=342ae45c0038924ed937479fc07908782253a85b;p=thirdparty%2Flibcgroup.git ftests/systemd: add method to check if systemd support Add a method to check if libcgroup is compiled with --enable-systemd support. The newly introduced is_systemd_enabled(), calls systemd C function is_systemd_enabled(), that return true if configured with --enable-systemd, false otherwise. Signed-off-by: Tom Hromatka --- diff --git a/tests/ftests/systemd.py b/tests/ftests/systemd.py index 826f3c40..dd339fbf 100644 --- a/tests/ftests/systemd.py +++ b/tests/ftests/systemd.py @@ -6,8 +6,9 @@ # Author: Tom Hromatka # +from cgroup import Cgroup as CgroupCli from run import Run, RunError -from cgroup import Cgroup +from libcgroup import Cgroup import os @@ -70,7 +71,12 @@ class Systemd(object): # In case the error occurs before the creation of slice/scope and # we may very well be on the teardown path, ignore the exception try: - Cgroup.delete(config, controller, cgname=_slice, ignore_systemd=True) + CgroupCli.delete(config, controller, cgname=_slice, ignore_systemd=True) except RunError as re: if 'No such file or directory' not in re.stderr: raise re + + # Check if libcgroup is compiled with --enable-systemd + @staticmethod + def is_systemd_enabled(): + return Cgroup.is_systemd_enabled()