From: Kamalesh Babulal Date: Thu, 5 Jun 2025 15:36:26 +0000 (+0530) Subject: ftests/utils: add get_distro() to detect Linux distribution X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=615efc7b7dba86eb81750eb9cdc7b4c1e6594bbb;p=thirdparty%2Flibcgroup.git ftests/utils: add get_distro() to detect Linux distribution Introduce helper function get_distro() to identify the current Linux distribution. Currently checks for 'Ubuntu' and 'Oracle Linux', which are the only distros used for testing. Can be extended to support others in the future. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/tests/ftests/utils.py b/tests/ftests/utils.py index 6dedfd90..c5267863 100644 --- a/tests/ftests/utils.py +++ b/tests/ftests/utils.py @@ -104,4 +104,13 @@ def is_output_same(config, out, expected_out): return result, cause +# get the current linux flavour +def get_distro(config): + with open('/etc/os-release', 'r') as relfile: + buf = relfile.read() + if "Oracle Linux" in buf: + return "oracle" + elif "Ubuntu" in buf: + return "ubuntu" + # vim: set et ts=4 sw=4: